public void CreateWithNullContainerWillThrow()
        {
            // Arrange
            var sut          = new SeedIgnoringRelay();
            var dummyRequest = new object();

            // Act & assert
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Create(dummyRequest, null));
        }
示例#2
0
        public void CreateWithNullContainerWillThrow()
        {
            // Fixture setup
            var sut          = new SeedIgnoringRelay();
            var dummyRequest = new object();

            // Exercise system and verify outcome
            Assert.Throws <ArgumentNullException>(() =>
                                                  sut.Create(dummyRequest, null));
            // Teardown
        }
        public void CreateWithNullRequestWillReturnNull()
        {
            // Arrange
            var sut = new SeedIgnoringRelay();
            // Act
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(null, dummyContainer);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
示例#4
0
        public void CreateWithNullRequestWillReturnNull()
        {
            // Fixture setup
            var sut = new SeedIgnoringRelay();
            // Exercise system
            var dummyContainer = new DelegatingSpecimenContext();
            var result         = sut.Create(null, dummyContainer);
            // Verify outcome
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
            // Teardown
        }
        public void CreateFromSeedWhenContainerCannotSatisfyWrappedRequestWillReturnNull()
        {
            // Arrange
            var anonymousSeed   = new SeededRequest(typeof(object), new object());
            var unableContainer = new DelegatingSpecimenContext {
                OnResolve = r => new NoSpecimen()
            };
            var sut = new SeedIgnoringRelay();
            // Act
            var result = sut.Create(anonymousSeed, unableContainer);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
示例#6
0
        public void CreateFromSeedWhenContainerCannotSatisfyWrappedRequestWillReturnNull()
        {
            // Fixture setup
            var anonymousSeed   = new SeededRequest(typeof(object), new object());
            var unableContainer = new DelegatingSpecimenContext {
                OnResolve = r => new NoSpecimen()
            };
            var sut = new SeedIgnoringRelay();
            // Exercise system
            var result = sut.Create(anonymousSeed, unableContainer);
            // Verify outcome
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
            // Teardown
        }
        public void CreateFromSeedWillCorrectlyInvokeContainer()
        {
            // Arrange
            var sut           = new SeedIgnoringRelay();
            var seededRequest = new SeededRequest(typeof(int), 1);

            var mockVerified  = false;
            var containerMock = new DelegatingSpecimenContext();

            containerMock.OnResolve = r =>
            {
                Assert.Equal(typeof(int), r);
                mockVerified = true;
                return(null);
            };
            // Act
            sut.Create(seededRequest, containerMock);
            // Assert
            Assert.True(mockVerified, "Mock verification");
        }
示例#8
0
        public void CreateFromSeedWillCorrectlyInvokeContainer()
        {
            // Fixture setup
            var sut           = new SeedIgnoringRelay();
            var seededRequest = new SeededRequest(typeof(int), 1);

            var mockVerified  = false;
            var containerMock = new DelegatingSpecimenContext();

            containerMock.OnResolve = r =>
            {
                Assert.Equal(typeof(int), r);
                mockVerified = true;
                return(null);
            };
            // Exercise system
            sut.Create(seededRequest, containerMock);
            // Verify outcome
            Assert.True(mockVerified, "Mock verification");
            // Teardown
        }