예제 #1
0
        public Test_Hive(HiveFixture fixture)
        {
            if (!fixture.LoginAndInitialize(action:
                                            () =>
            {
                // This adds a [HostsFixture] to the [HiveFixture] (which inherits
                // from [TestFixtureSet]).  We'll name the HostFixture so we can use
                // it to setup local DNS entries for the tests.

                fixture.AddFixture("hosts", hosts = new HostsFixture());
            }))
            {
                // This call ensures that the hive is reset to a
                // pristine state before each test is invoked.

                fixture.Reset();

                // Retrieve the hosts fixture and reset it.

                hosts = (HostsFixture)fixture["hosts"];
                hosts.Reset();
            }

            this.hiveFixture = fixture;
            this.hive        = fixture.Hive;
        }
예제 #2
0
        public Test_Docker(DockerFixture fixture)
        {
            this.fixture = fixture;

            var reset = fixture.Initialize(
                () =>
            {
                // We're going to add a [HostsFixture] so tests can modify
                // the local [hosts] file to customize DNS lookups.  Note
                // that subfixtures are identified by name and can be
                // retrieved later using a fixture indexer.

                fixture.AddFixture("hosts", new HostsFixture());

                // Add a Couchbase instance to the test.

                fixture.AddFixture("couchbase", new CouchbaseFixture(), subFixture => subFixture.StartInAction());
            });

            // Fetch the hosts fixture so it'll be easy to access from
            // the tests.

            hosts     = (HostsFixture)fixture["hosts"];
            couchbase = (CouchbaseFixture)fixture["couchbase"];
            bucket    = couchbase.Bucket;

            if (!reset)
            {
                // Reset the fixture state if the [Initialize()]
                // method hasn't already done so.

                hosts.Reset();
                fixture.Reset();
                couchbase.Clear();
            }
        }