コード例 #1
0
        public static void Initialization(ExampleFixture fixture)
        {
            "Given a test fixture"
            .x(() => fixture = new ExampleFixture());

            "When I initialize the fixture"
            .x(() => Fake.InitializeFixture(fixture));

            "Then the sut is set"
            .x(() => fixture.Sut.Should().NotBeNull());

            "And dependencies are injected into the sut from the fixture"
            .x(() => fixture.Sut.Foo.Should().BeSameAs(fixture.Foo));

            "And dependencies are injected into the sut even when not available in fixture"
            .x(() => fixture.Sut.ServiceProvider.Should().NotBeNull());

            "And dependencies of the same type are the same instance"
            .x(() => fixture.Sut.Foo.Should().BeSameAs(fixture.Sut.Foo2));

            "And public attributed fixture fields are set"
            .x(() => fixture.FooField.Should().NotBeNull());

            "And public unattributed fixture fields are not set"
            .x(() => fixture.UnattributedFooField.Should().BeNull());

            "And private attributed fixture properties are set"
            .x(() => typeof(ExampleFixture).GetProperty("PrivateFoo", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(fixture).Should().NotBeNull());

            "And private attributed fixture fields are set"
            .x(() => typeof(ExampleFixture).GetField("privateFoo", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(fixture).Should().NotBeNull());

            "And public unattributed fixture properties are not set"
            .x(() => fixture.UnattributedFoo.Should().BeNull());
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        public static 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());
        }
コード例 #4
0
 public AuthoriseByRelatedTests(ExampleFixture <AuthoriseByRelatedTests> fixture)
 {
     HttpClient = fixture.HttpClient;
 }
コード例 #5
0
 public SettersTests(ExampleFixture <SettersTests> fixture)
 {
     HttpClient = fixture.HttpClient;
 }
コード例 #6
0
 public HomeDirectoryTests(ExampleFixture <HomeDirectoryTests> fixture)
 {
     HttpClient = fixture.HttpClient;
 }
コード例 #7
0
 public IdentifierTests(ExampleFixture <IdentifierTests> fixture)
 {
     HttpClient = fixture.HttpClient;
 }
コード例 #8
0
 public AutoMapTests(ExampleFixture <AutoMapTests> fixture)
 {
     HttpClient = fixture.HttpClient;
 }
コード例 #9
0
 public GettersAndQueryTests(ExampleFixture <GettersAndQueryTests> fixture)
 {
     HttpClient = fixture.HttpClient;
 }
コード例 #10
0
 public SubstemTests(ExampleFixture <SubstemTests> fixture)
 {
     HttpClient = fixture.HttpClient;
 }
コード例 #11
0
 public ComplexFieldGettersTests(ExampleFixture <ComplexFieldGettersTests> fixture)
 {
     HttpClient = fixture.HttpClient;
 }