예제 #1
0
 public void CreateWithNullContextThrows()
 {
     // Fixture setup
     var sut = new MultipleRelay();
     var dummyRequest = new object();
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.Create(dummyRequest, null));
     // Teardown
 }
예제 #2
0
 public void CreateWithAnonymousRequestReturnsCorrectResult()
 {
     // Fixture setup
     var sut = new MultipleRelay();
     var request = new object();
     // Exercise system
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(request, dummyContainer);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
예제 #3
0
        public void CreateWithManyRequestReturnsCorrectResult()
        {
            // Fixture setup
            var request = new MultipleRequest(new object());
            var count = 7;
            var expectedTranslation = new FiniteSequenceRequest(request.Request, 7);
            var expectedResult = new object();
            var container = new DelegatingSpecimenContext { OnResolve = r => expectedTranslation.Equals(r) ? expectedResult : new NoSpecimen(r) };

            var sut = new MultipleRelay { Count = count };
            // Exercise system
            var result = sut.Create(request, container);
            // Verify outcome
            Assert.Equal(expectedResult, result);
            // Teardown
        }
예제 #4
0
        public void CreateWithInvalidRequestReturnsCorrectResult(object request)
        {
            // Fixture setup
            var sut = new MultipleRelay();
            // Exercise system
            var dummyContainer = new DelegatingSpecimenContext();
            var result = sut.Create(request, dummyContainer);
            // Verify outcome
#pragma warning disable 618
            var expectedResult = new NoSpecimen(request);
#pragma warning restore 618
            Assert.Equal(expectedResult, result);
            // Teardown
        }