public void DoStuffWithNullContextWillThrow(NameAppender sut, SomeValue sv) { // Fixture setup // Exercise system and verify outcome Assert.Throws<ArgumentNullException>(() => sut.DoStuff(sv, null)); // Teardown }
public void DoStuffWillAppendContextNameToMessage(NameAppender sut, SomeValue value, string contextName, Mock<ISomeContext> contextStub) { // Fixture setup var expectedResult = contextName + value.Message; contextStub.SetupGet(ctx => ctx.Name).Returns(contextName); // Exercise system var result = sut.DoStuff(value, contextStub.Object); // Verify outcome Assert.Equal<string>(expectedResult, result); // Teardown }