Пример #1
0
 public void CreateFromNonMatchingRequestReturnsCorrectResult(
     object request)
 {
     // Fixture setup
     var from = typeof(OperatingSystem);
     var dummyTo = typeof(object);
     var sut = new TypeRelay(from, dummyTo);
     // Exercise system
     var dummyContext = new DelegatingSpecimenContext();
     var actual = sut.Create(request, dummyContext);
     // Verify outcome
     var expected = new NoSpecimen(request);
     Assert.Equal(expected, actual);
     // Teardown
 }
Пример #2
0
 public void CreateFromMatchingRequestReturnsCorrectResult(
     Type from,
     Type to)
 {
     // Fixture setup
     var sut = new TypeRelay(from, to);
     var expected = new object();
     var context = new DelegatingSpecimenContext
     {
         OnResolve = r => to.Equals(r) ? expected : new object()
     };
     // Exercise system
     var actual = sut.Create(from, context);
     // Verify outcome
     Assert.Equal(expected, actual);
     // Teardown
 }
Пример #3
0
 public void CreateWithNullContextThrows()
 {
     // Fixture setup
     var dummyFrom = typeof(object);
     var dummyTo = typeof(object);
     var sut = new TypeRelay(dummyFrom, dummyTo);
     // Exercise system and verify outcome
     var dummyRequest = new object();
     Assert.Throws<ArgumentNullException>(() =>
         sut.Create(dummyRequest, null));
     // Teardown
 }