Пример #1
0
        public void Create_WithRequestThatIsNotAType_ReturnsNoSpecimen(object request)
        {
            // Arrange
            var specification = new TrueRequestSpecification();
            var sut           = new NSubstituteBuilder(Substitute.For <ISpecimenBuilder>(), specification);
            var context       = Substitute.For <ISpecimenContext>();
            // Act
            var result = sut.Create(request, context);
            // Assert
            var expected = new NoSpecimen();

            Assert.Equal(expected, result);
        }
Пример #2
0
        public void Create_WithRequestThatDoesNotMatchSpecification_ReturnsNoSpecimen()
        {
            // Arrange
            var specification = new FalseRequestSpecification();
            var sut           = new NSubstituteBuilder(Substitute.For <ISpecimenBuilder>(), specification);
            var context       = Substitute.For <ISpecimenContext>();
            var request       = typeof(ConcreteType);
            // Act
            var result = sut.Create(request, context);
            // Assert
            var expected = new NoSpecimen();

            Assert.Equal(expected, result);
        }
Пример #3
0
        public void Create_WithRequestThatIsNotAType_ReturnsNoSpecimen(object request)
        {
            // Fixture setup
            var specification = new TrueRequestSpecification();
            var sut           = new NSubstituteBuilder(Substitute.For <ISpecimenBuilder>(), specification);
            var context       = Substitute.For <ISpecimenContext>();

            // Exercise system
            var result = sut.Create(request, context);

            // Verify outcome
            var expected = new NoSpecimen();

            Assert.Equal(expected, result);
        }
Пример #4
0
        public void CreateWithAbstractionRequest_ReturnsResultFromDecoratedBuilder(Type request)
        {
            // Arrange
            var builder  = Substitute.For <ISpecimenBuilder>();
            var context  = Substitute.For <ISpecimenContext>();
            var expected = new object();

            builder.Create(request, context).Returns(expected);
            var sut = new NSubstituteBuilder(builder);
            // Act
            var result = sut.Create(request, context);

            // Assert
            Assert.Same(expected, result);
        }
Пример #5
0
        public void CreateWithAbstractionRequest_ReturnsNoSpecimen_WhenDecoratedBuilderReturnsNull(Type request)
        {
            // Arrange
            var builder = Substitute.For <ISpecimenBuilder>();
            var context = Substitute.For <ISpecimenContext>();

            builder.Create(request, context).Returns(null);
            var sut = new NSubstituteBuilder(builder);
            // Act
            var result = sut.Create(request, context);
            // Assert
            var expected = new NoSpecimen();

            Assert.Equal(expected, result);
        }
Пример #6
0
        public void CreateWithAbstractionRequest_ReturnsResultFromDecoratedBuilder(Type request)
        {
            // Fixture setup
            var builder  = Substitute.For <ISpecimenBuilder>();
            var context  = Substitute.For <ISpecimenContext>();
            var expected = new object();

            builder.Create(request, context).Returns(expected);
            var sut = new NSubstituteBuilder(builder);

            // Exercise system
            var result = sut.Create(request, context);

            // Verify outcome
            Assert.Same(expected, result);
        }
Пример #7
0
        public void Create_WithRequestThatDoesNotMatchSpecification_ReturnsNoSpecimen()
        {
            // Fixture setup
            var specification = new FalseRequestSpecification();
            var sut           = new NSubstituteBuilder(Substitute.For <ISpecimenBuilder>(), specification);
            var context       = Substitute.For <ISpecimenContext>();
            var request       = typeof(ConcreteType);

            // Exercise system
            var result = sut.Create(request, context);

            // Verify outcome
            var expected = new NoSpecimen(request);

            Assert.Equal(expected, result);
        }
Пример #8
0
        public void CreateWithAbstractionRequest_ReturnsNoSpecimen_WhenDecoratedBuilderReturnsNull(Type request)
        {
            // Fixture setup
            var builder = Substitute.For <ISpecimenBuilder>();
            var context = Substitute.For <ISpecimenContext>();

            builder.Create(request, context).Returns(null);
            var sut = new NSubstituteBuilder(builder);

            // Exercise system
            var result = sut.Create(request, context);

            // Verify outcome
            var expected = new NoSpecimen();

            Assert.Equal(expected, result);
        }
        public void CreateWithAbstractionRequest_ReturnsNoSpecimen_WhenDecoratedBuilderReturnsNull(Type request)
        {
            // Fixture setup
            var builder = Substitute.For<ISpecimenBuilder>();
            var context = Substitute.For<ISpecimenContext>();
            builder.Create(request, context).Returns(null);
            var sut = new NSubstituteBuilder(builder);

            // Exercise system
            var result = sut.Create(request, context);

            // Verify outcome
            var expected = new NoSpecimen(request);
            Assert.Equal(expected, result);
        }
        public void Create_WithRequestThatIsNotAType_ReturnsNoSpecimen(object request)
        {
            // Fixture setup
            var specification = new TrueRequestSpecification();
            var sut = new NSubstituteBuilder(Substitute.For<ISpecimenBuilder>(), specification);
            var context = Substitute.For<ISpecimenContext>();

            // Exercise system
            var result = sut.Create(request, context);

            // Verify outcome
            var expected = new NoSpecimen(request);
            Assert.Equal(expected, result);
        }
        public void Create_WithRequestThatDoesNotMatchSpecification_ReturnsNoSpecimen()
        {
            // Fixture setup
            var specification = new FalseRequestSpecification();
            var sut = new NSubstituteBuilder(Substitute.For<ISpecimenBuilder>(), specification);
            var context = Substitute.For<ISpecimenContext>();
            var request = typeof(ConcreteType);

            // Exercise system
            var result = sut.Create(request, context);

            // Verify outcome
            var expected = new NoSpecimen(request);
            Assert.Equal(expected, result);
        }
        public void CreateWithAbstractionRequest_ReturnsResultFromDecoratedBuilder(Type request)
        {
            // Fixture setup
            var builder = Substitute.For<ISpecimenBuilder>();
            var context = Substitute.For<ISpecimenContext>();
            var expected = new object();
            builder.Create(request, context).Returns(expected);
            var sut = new NSubstituteBuilder(builder);

            // Exercise system
            var result = sut.Create(request, context);

            // Verify outcome
            Assert.Same(expected, result);
        }