public void Should_set_sut_from_sut_initializer()
        {
            // Arrange
            var sut = A.Dummy <Sut>();

            A.CallTo(() => this.sutInitializer.CreateSut(A <Type> ._, A <Action <Type, object> > ._))
            .Returns(sut);

            var sutFixture = new SutFixture();

            // Act
            this.initializer.InitializeFakes(sutFixture);

            // Assert
            sutFixture.Sut.Should().BeSameAs(sut);
        }
        public void Should_set_fake_from_sut_initializer_callback_when_available()
        {
            // Arrange
            var fake = A.Fake <IFoo>();

            A.CallTo(() => this.sutInitializer.CreateSut(A <Type> ._, A <Action <Type, object> > ._))
            .Invokes(x => x.GetArgument <Action <Type, object> >(1).Invoke(typeof(IFoo), fake));

            var sutFixture = new SutFixture();

            // Act
            this.initializer.InitializeFakes(sutFixture);

            // Assert
            sutFixture.Foo.Should().BeSameAs(fake);
        }
        public void Should_set_fake_from_sut_initializer_call_back_when_available()
        {
            // Arrange
            var sut = A.Dummy<Sut>();
            var fake = A.Fake<IFoo>();

            A.CallTo(() => this.sutInitializer.CreateSut(A<Type>._, A<Action<Type, object>>._))
                .Invokes(x => x.GetArgument<Action<Type, object>>(1).Invoke(typeof(IFoo), fake));

            var fixture = new SutFixture();

            // Act
            this.initializer.InitializeFakes(fixture);

            // Assert
            Assert.That(fixture.foo, Is.SameAs(fake));
        }
        public void Should_set_sut_from_sut_initializer()
        {
            // Arrange
            var sut = A.Dummy<Sut>();

            A.CallTo(() => this.sutInitializer.CreateSut(A<Type>._, A<Action<Type, object>>._))
                .Returns(sut);

            var fixture = new SutFixture();

            // Act
            this.initializer.InitializeFakes(fixture);

            // Assert
            Assert.That(fixture.sut, Is.SameAs(sut));
        }
        public void Should_set_fake_from_sut_initializer_callback_when_available()
        {
            // Arrange
            var fake = A.Fake<IFoo>();

            A.CallTo(() => this.sutInitializer.CreateSut(A<Type>._, A<Action<Type, object>>._))
                .Invokes(x => x.GetArgument<Action<Type, object>>(1).Invoke(typeof(IFoo), fake))
                .Returns(null);

            var sutFixture = new SutFixture();

            // Act
            this.initializer.InitializeFakes(sutFixture);

            // Assert
            sutFixture.Foo.Should().BeSameAs(fake);
        }