Created
July 28, 2022 22:09
-
-
Save es-repo/71d7202c8118beb6e12cf0fa2ec8200e to your computer and use it in GitHub Desktop.
Test Case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static object[] BoxAndLabelsAndThings_OpenBoxThenPutThingInsideThenCloseBoxAndWriteLogs_ThingsWithLabelEndedWithIgnoreExpected_1() | |
{ | |
var writeLogMock = new Mock<WriteLog>(MockBehavior.Strict); | |
var boxMock = new Mock<IBox>(MockBehavior.Strict); | |
var mockSequence = new MockSequence(); | |
boxMock.InSequence(mockSequence).Setup(box => box.Open()); | |
writeLogMock.InSequence(mockSequence).Setup(writeLog => writeLog("The box is opened.")); | |
boxMock.InSequence(mockSequence).Setup(box => box.PutInside(new Thing { Size = 1 }, "Label 1")).Returns(true); | |
boxMock.InSequence(mockSequence).Setup(box => box.PutInside(new Thing { Size = 2 }, "Label 2 Ignore")).Returns(false); | |
boxMock.InSequence(mockSequence).Setup(box => box.PutInside(new Thing { Size = 3 }, "Label 3")).Returns(true); | |
boxMock.InSequence(mockSequence).Setup(box => box.Close()); | |
writeLogMock.InSequence(mockSequence).Setup(writeLog => writeLog("The box is closed.")); | |
var args = new Args | |
{ | |
Box = boxMock.Object, | |
LabelsAndThings = new Dictionary<string, Thing> | |
{ | |
{ "Label 1", new Thing { Size = 1 } }, | |
{ "Label 2 Ignore", new Thing { Size = 2 } }, | |
{ "Label 3", new Thing { Size = 3 } }, | |
}, | |
WriteLog = writeLogMock.Object | |
}; | |
var expected = new Dictionary<string, Thing> | |
{ | |
{ "Label 2 Ignore", new Thing { Size = 2 } }, | |
}; | |
return new object[] { args, expected }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment