public static void Initialization(ExampleFixture fixture) { "given a test fixture" .x(() => fixture = new ExampleFixture()); "when the fixture is initialized" .x(() => Fake.InitializeFixture(fixture)); "then the sut should be set" .x(() => fixture.Sut.Should().NotBeNull()); "and dependencies should be injected into the sut from the fixture" .x(() => fixture.Sut.Foo.Should().BeSameAs(fixture.Foo)); "and dependencies should be injected into the sut even when not available in fixture" .x(() => fixture.Sut.ServiceProvider.Should().NotBeNull()); "and dependencies of the same type should be the same instance" .x(() => fixture.Sut.Foo.Should().BeSameAs(fixture.Sut.Foo2)); }
public void Initialization() { "establish" .x(() => Fixture = new ExampleFixture()); "when initializing fixture" .x(() => Fake.InitializeFixture(Fixture)); "it should set sut" .x(() => Fixture.Sut.Should().NotBeNull()); "it should use the same instance when more than one dependency is of the same type" .x(() => Fixture.Sut.Foo.Should().BeSameAs(Fixture.Sut.Foo2)); "it should inject fake from fixture" .x(() => Fixture.Sut.Foo.Should().BeSameAs(Fixture.Foo)); "it should inject fake when not available in fixture" .x(() => Fixture.Sut.ServiceProvider.Should().NotBeNull()); }