public void FinalizeInstanceWithDependencyDefined()
        {
            ObjectActivatorTests.TestActivator <IActivatorTest, ActivatorTest>(container =>
            {
                // Arrange...
                // ... register more items into the container...
                var newBuilder = new ContainerBuilder();
                newBuilder
                .RegisterType <ActivatorWithDependencyTest>()
                .As <IDependentActivatorTest>();
                newBuilder
                .RegisterType <ObjectPortal <IDependentActivatorTest> >()
                .As <IObjectPortal <IDependentActivatorTest> >();
                // ... append new registrations to the container given by the TestActivator Action...
                newBuilder.Update(container);
                // ... still arranging...
                var activator = new ObjectActivator(container);
                var obj       = activator.CreateInstance(typeof(IDependentActivatorTest));
                activator.InitializeInstance(obj);

                // Act...
                activator.FinalizeInstance(obj);

                // Assert...
                ActivatorWithDependencyTest target = (ActivatorWithDependencyTest)obj;
                var aDependency = target.GetType().GetProperty("ADependency", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(target, null);
                Assert.IsNull(aDependency);
            });
        }
        public void InitializeInstanceWithClientSideDependencyDefined()
        {
            // Arrange...
            // ... register more items into the container...
            var aTestString      = "Some-Test-String";
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterType <ActivatorTest>()
            .As <IActivatorTest>();
            containerBuilder.RegisterType <ObjectPortal <IActivatorTest> >()
            .As <IObjectPortal <IActivatorTest> >();
            containerBuilder.RegisterType <ActivatorWithDependencyTest>()
            .As <IDependentActivatorTest>();
            containerBuilder.RegisterType <ObjectPortal <IDependentActivatorTest> >()
            .As <IObjectPortal <IDependentActivatorTest> >();

            // ... append new registrations to the container given by the TestActivator Action...
            using (new ObjectActivator(containerBuilder.Build()).Bind(() => ApplicationContext.DataPortalActivator))
            {
                // Act...
                var obj = DataPortal.Fetch <IDependentActivatorTest>("some-data");

                // Assert...
                ActivatorWithDependencyTest target = (ActivatorWithDependencyTest)obj;
                var firstDep = target.GetType().GetProperty("ADependency", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(target, null);
                Assert.IsNull(firstDep);
                var secondDep = target.GetType().GetProperty("BDependency", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(target, null);
                Assert.IsInstanceOfType(secondDep, typeof(IObjectPortal <IActivatorTest>));
                Assert.AreEqual(aTestString, target.AccessClientSideDependency(aTestString));
            }
        }