-
-
Save shiftkey/1283166 to your computer and use it in GitHub Desktop.
Good test/ bad test?
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
[TestMethod] | |
public void GetContextId_OnSecondRun_ReturnsStoredContextId() // "should" is a grey phrase | |
{ | |
const string firstId = "200"; // context is used a lot in the test - removed here | |
const string secondId = "400"; // and i isolate these from my arrange for readability | |
// arrange | |
var record = new ContextRecord(); | |
fakeRecordGenerator.Generate().Returns(record); // overuse of "Record" in here? necessary? | |
fakeContextService.CreateContext(record).Returns(firstId); | |
contextManager.GetContextId(); // why do we need to set the mock behaviour twice? | |
fakeContextService.CreateContext(record).Returns(secondId); | |
// act | |
var resultContextId = contextManager.GetContextId(); | |
Assert.AreEqual(firstContextId, resultContextId); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment