public void CreateWithNonFakeRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var dummyBuilder = A.Fake<ISpecimenBuilder>();
     var sut = new FakeItEasyBuilder(dummyBuilder);
     // Exercise system
     var dummyContext = A.Fake<ISpecimenContext>();
     var result = sut.Create(request, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen();
     Assert.Equal(expectedResult, result);
     // Teardown
 }
Exemplo n.º 2
0
        public void CreateWithNonFakeRequestReturnsCorrectResult(object request)
        {
            // Arrange
            var dummyBuilder = A.Fake <ISpecimenBuilder>();
            var sut          = new FakeItEasyBuilder(dummyBuilder);
            // Act
            var dummyContext = A.Fake <ISpecimenContext>();
            var result       = sut.Create(request, dummyContext);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
        public void CreateWithNonFakeRequestReturnsCorrectResult(object request)
        {
            // Fixture setup
            var dummyBuilder = A.Fake <ISpecimenBuilder>();
            var sut          = new FakeItEasyBuilder(dummyBuilder);
            // Exercise system
            var dummyContext = A.Fake <ISpecimenContext>();
            var result       = sut.Create(request, dummyContext);
            // Verify outcome
            var expectedResult = new NoSpecimen(request);

            Assert.Equal(expectedResult, result);
            // Teardown
        }
Exemplo n.º 4
0
        public void CreateWithFakeRequestReturnsCorrectResultWhenContextReturnsNonFake(Type request, object contextValue)
        {
            // Arrange
            var context     = new Fake <ISpecimenContext>().FakedObject;
            var builderStub = new Fake <ISpecimenBuilder>();

            builderStub.CallsTo(b => b.Create(request, context))
            .Returns(contextValue);
            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Act
            var result = sut.Create(request, context);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
        public void CreateWithFakeRequestReturnsCorrectResult()
        {
            // Fixture setup
            var request = typeof(Fake<object>);
            var context = new Fake<ISpecimenContext>().FakedObject;

            var builderStub = new Fake<ISpecimenBuilder>();
            builderStub.CallsTo(b => b.Create(request, context)).Returns(new Fake<object>());

            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Exercise system
            var result = sut.Create(request, context);
            // Verify outcome
            Assert.IsAssignableFrom<Fake<object>>(result);
            // Teardown
        }
Exemplo n.º 6
0
        public void CreateWithFakeRequestReturnsCorrectResult()
        {
            // Arrange
            var request = typeof(Fake <object>);
            var context = new Fake <ISpecimenContext>().FakedObject;

            var builderStub = new Fake <ISpecimenBuilder>();

            builderStub.CallsTo(b => b.Create(request, context)).Returns(new Fake <object>());

            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Act
            var result = sut.Create(request, context);

            // Assert
            Assert.IsAssignableFrom <Fake <object> >(result);
        }
Exemplo n.º 7
0
        public void CreateFromFakeRequestWhenDecoratedBuilderReturnsNoFakeReturnsCorrectResult(object request, object innerResult)
        {
            // Arrange
            var context = new Fake <ISpecimenContext>().FakedObject;

            var builderStub = new Fake <ISpecimenBuilder>();

            builderStub.CallsTo(b => b.Create(request, context)).Returns(innerResult);

            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Act
            var result = sut.Create(request, context);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
        public void CreateWithFakeRequestReturnsCorrectResultWhenContextReturnsNonFake(Type request, object contextValue)
        {
            // Fixture setup
            var context     = new Fake <ISpecimenContext>().FakedObject;
            var builderStub = new Fake <ISpecimenBuilder>();

            builderStub.CallsTo(b => b.Create(request, context))
            .Returns(contextValue);
            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Exercise system
            var result = sut.Create(request, context);
            // Verify outcome
            var expectedResult = new NoSpecimen(request);

            Assert.Equal(expectedResult, result);
            // Teardown
        }
Exemplo n.º 9
0
        public void CreateFromFakeRequestWhenDecoratedBuilderReturnsFakeOfWrongGenericTypeReturnsCorrectResult()
        {
            // Arrange
            var request = typeof(Fake <IInterface>);
            var context = new Fake <ISpecimenContext>().FakedObject;

            var builderStub = new Fake <ISpecimenBuilder>();

            builderStub.CallsTo(b => b.Create(request, context)).Returns(new Fake <AbstractType>());

            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Act
            var result = sut.Create(request, context);
            // Assert
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
        }
Exemplo n.º 10
0
        public void CreateWithFakeRequestReturnsCorrectResult()
        {
            // Fixture setup
            var request = typeof(Fake <object>);
            var context = new Fake <ISpecimenContext>().FakedObject;

            var builderStub = new Fake <ISpecimenBuilder>();

            builderStub.CallsTo(b => b.Create(request, context)).Returns(new Fake <object>());

            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Exercise system
            var result = sut.Create(request, context);

            // Verify outcome
            Assert.IsAssignableFrom <Fake <object> >(result);
            // Teardown
        }
Exemplo n.º 11
0
        public void CreateFromFakeRequestWhenDecoratedBuilderReturnsNoFakeReturnsCorrectResult(object request, object innerResult)
        {
            // Fixture setup
            var context = new Fake <ISpecimenContext>().FakedObject;

            var builderStub = new Fake <ISpecimenBuilder>();

            builderStub.CallsTo(b => b.Create(request, context)).Returns(innerResult);

            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Exercise system
            var result = sut.Create(request, context);
            // Verify outcome
            var expectedResult = new NoSpecimen();

            Assert.Equal(expectedResult, result);
            // Teardown
        }
Exemplo n.º 12
0
        public void CreateFromFakeRequestWhenDecoratedBuilderReturnsFakeOfWrongGenericTypeReturnsCorrectResult()
        {
            // Fixture setup
            var request = typeof(Fake <IInterface>);
            var context = new Fake <ISpecimenContext>().FakedObject;

            var builderStub = new Fake <ISpecimenBuilder>();

            builderStub.CallsTo(b => b.Create(request, context)).Returns(new Fake <AbstractType>());

            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Exercise system
            var result = sut.Create(request, context);

            // Verify outcome
#pragma warning disable 618
            var expectedResult = new NoSpecimen(request);
#pragma warning restore 618
            Assert.Equal(expectedResult, result);
            // Teardown
        }
 public void CreateWithFakeRequestReturnsCorrectResultWhenContextReturnsNonFake(Type request, object contextValue)
 {
     // Fixture setup
     var context = new Fake<ISpecimenContext>().FakedObject;
     var builderStub = new Fake<ISpecimenBuilder>();
     builderStub.CallsTo(b => b.Create(request, context))
         .Returns(contextValue);
     var sut = new FakeItEasyBuilder(builderStub.FakedObject);
     // Exercise system
     var result = sut.Create(request, context);
     // Verify outcome
     var expectedResult = new NoSpecimen();
     Assert.Equal(expectedResult, result);
     // Teardown
 }
        public void CreateFromFakeRequestWhenDecoratedBuilderReturnsFakeOfWrongGenericTypeReturnsCorrectResult()
        {
            // Fixture setup
            var request = typeof(Fake<IInterface>);
            var context = new Fake<ISpecimenContext>().FakedObject;

            var builderStub = new Fake<ISpecimenBuilder>();
            builderStub.CallsTo(b => b.Create(request, context)).Returns(new Fake<AbstractType>());

            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Exercise system
            var result = sut.Create(request, context);
            // Verify outcome
            var expectedResult = new NoSpecimen();
            Assert.Equal(expectedResult, result);
            // Teardown
        }
Exemplo n.º 15
0
        public void CreateFromFakeRequestWhenDecoratedBuilderReturnsNoFakeReturnsCorrectResult(object request, object innerResult)
        {
            // Fixture setup
            var context = new Fake<ISpecimenContext>().FakedObject;

            var builderStub = new Fake<ISpecimenBuilder>();
            builderStub.CallsTo(b => b.Create(request, context)).Returns(innerResult);

            var sut = new FakeItEasyBuilder(builderStub.FakedObject);
            // Exercise system
            var result = sut.Create(request, context);
            // Verify outcome
            var expectedResult = new NoSpecimen(request);
            Assert.Equal(expectedResult, result);
            // Teardown
        }