public static void Should_resolve_lower_level_container_registration_When_lower_level_container_has_same_registration_as_upper_container(
            HierarchyServiceRegistration.Case @case)
        {
            // Arrange
            var theoryItem = @case.Promise.Resolve();

            var arrangeUpperLevelObject = new TestDependency();
            var arrangeLowerLevelObject = new TestDependency();

            object expectedUpperLevelObject = arrangeUpperLevelObject;
            object actualUpperLevelObject   = null;

            object expectedLowerLevelObject = arrangeLowerLevelObject;
            object actualLowerLevelObject   = null;

            // Act
            theoryItem.SetupConfig(
                (
                    builder,
                    provider) =>
            {
                builder.ConfigureServices(
                    (
                        context,
                        collection) =>
                {
                    collection.AddSingleton <ITestDependency>(arrangeUpperLevelObject);
                });
            });
            theoryItem.SetupCheck(
                host =>
            {
                actualUpperLevelObject = host.Services.GetService <ITestDependency>();
            });

            theoryItem.SetupExtension(new ConfigureDependenciesTheoryExtension().Setup(s => s.AddSingleton <ITestDependency>(arrangeLowerLevelObject)));
            theoryItem.SetupExtension(new PickDependencyTheoryExtension().Setup(typeof(ITestDependency), o => actualLowerLevelObject = o));
            theoryItem.Try();

            // Assert
            Assert.Same(expectedUpperLevelObject, actualUpperLevelObject);
            Assert.Same(expectedLowerLevelObject, actualLowerLevelObject);
        }
        public static void Should_resolve_different_transient_instance_From_hierarchy_transient_type_registration(
            HierarchyServiceRegistration.Case @case)
        {
            // Arrange
            var theoryItem = @case.Promise.Resolve();

            var arrangeDescriptor = new ServiceDescriptor(typeof(ITestDependency), typeof(TestDependency), ServiceLifetime.Transient);

            object expectedObject = null;
            object actualObject   = null;

            // Act
            theoryItem.SetupConfig(
                (
                    builder,
                    provider) =>
            {
                builder.ConfigureServices(
                    (
                        context,
                        collection) =>
                {
                    collection.Add(arrangeDescriptor);
                });
            });
            theoryItem.SetupCheck(
                host =>
            {
                expectedObject = host.Services.GetService <ITestDependency>();
            });

            theoryItem.SetupExtension(new PickDependencyTheoryExtension().Setup(typeof(ITestDependency), o => actualObject = o));
            theoryItem.Try();

            // Assert
            Assert.NotSame(expectedObject, actualObject);
        }