예제 #1
0
 public void DoStuffWithNullContextWillThrow(SomeClass sut, SomeValue sv)
 {
     // Fixture setup
     ISomeContext nullContext = null;
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.DoStuff(sv, nullContext));
     // Teardown
 }
예제 #2
0
 public void DoStuffWillReturnContextName(SomeClass sut, string expectedName, Mock<ISomeContext> contextStub, SomeValue sv)
 {
     // Fixture setup
     contextStub.SetupGet(ctx => ctx.Name).Returns(expectedName);
     // Exercise system
     var result = sut.DoStuff(sv, contextStub.Object);
     // Verify outcome
     Assert.Equal(expectedName, result);
     // Teardown
 }