コード例 #1
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeCustomNonGenericHierarchy2_Cluster>(
                    null
                    );

                var scope0 = cluster.CreateCustomScope();
                var scope1 = cluster.CreateCustomScope();

                var b0_0 = (IB)cluster.Get(typeof(IB), scope0);

                Assert.IsNotNull(b0_0);
                Assert.IsNotNull(b0_0.A);
                Assert.AreEqual(Message, b0_0.Message);

                var b1 = (IB)cluster.Get(typeof(IB), scope1);

                Assert.IsNotNull(b1);
                Assert.IsNotNull(b1.A);
                Assert.AreEqual(Message, b1.Message);

                var b0_1 = (IB)cluster.Get(typeof(IB), scope0);

                Assert.IsNotNull(b0_1);
                Assert.IsNotNull(b0_1.A);
                Assert.AreEqual(Message, b0_1.Message);

                Assert.AreNotSame(b0_0, b0_1);
                Assert.AreSame(b0_0.A, b0_1.A);

                Assert.AreNotSame(b0_0, b1);
                Assert.AreNotSame(b0_0.A, b1.A);
            }
コード例 #2
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ConditionalNonGenericHierarchy2_Cluster>(
                    null
                    );

                var a = (IA)cluster.Get(typeof(IA));

                Assert.IsNotNull(a);
                Assert.IsTrue(a.GetType() == typeof(A1));

                var b0 = (IB)cluster.Get(typeof(IB));

                Assert.IsNotNull(b0);
                Assert.IsNotNull(b0.A);
                Assert.AreNotSame(a, b0.A);
                Assert.IsTrue(b0.A.GetType() == typeof(A1));

                var b1 = (IB)cluster.Get(typeof(IB));

                Assert.IsNotNull(b1);
                Assert.IsNotNull(b1.A);
                Assert.AreNotSame(b0, b1);
                Assert.IsTrue(b1.A.GetType() == typeof(A1));
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <WrapperFuncNonGenericHierarchy2_Cluster>(
                    null
                    );

                var a = (IA)cluster.Get(typeof(IA));

                Assert.IsNotNull(a);

                var b0 = (IB)cluster.Get(typeof(IB));

                Assert.IsNotNull(b0);
                Assert.IsNotNull(b0.A);
            }
コード例 #4
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <WrapperFuncGenericHierarchy2_Cluster>(
                    null
                    );

                var a = cluster.Get <IA>();

                Assert.IsNotNull(a);

                var b0 = cluster.Get <IB>();

                Assert.IsNotNull(b0);
                Assert.IsNotNull(b0.A);
            }
コード例 #5
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <FactorySimple0_Cluster>(
                    null
                    );

                var af = cluster.Get <IAFactory>();

                Assert.IsNotNull(af);

                var a0 = af.Create();

                Assert.IsNotNull(a0);

                var a1 = af.Create();

                Assert.IsNotNull(a1);

                Assert.AreNotSame(a0, a1);

                var a2 = af.Create(0);

                Assert.IsNotNull(a2);

                var unused = 0L;
                var a3     = af.Create(ref unused);

                Assert.IsNotNull(a3);
            }
コード例 #6
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ConditionalGenericHierarchy2SameConstant_Cluster>(
                    null
                    );

                var b1 = cluster.Get <IB1>();

                Assert.IsNotNull(b1);
                Assert.AreSame(ConstantA1, b1.A);

                var b2 = cluster.Get <IB2>();

                Assert.IsNotNull(b2);
                Assert.AreSame(ConstantA2, b2.A);
            }
コード例 #7
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ConditionalNonGenericHierarchy2SameConstant_Cluster>(
                    null
                    );

                var b1 = (IB1)cluster.Get(typeof(IB1));

                Assert.IsNotNull(b1);
                Assert.AreSame(ConstantA1, b1.A);

                var b2 = (IB2)cluster.Get(typeof(IB2));

                Assert.IsNotNull(b2);
                Assert.AreSame(ConstantA2, b2.A);
            }
コード例 #8
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <NonGenericIncorrectRequest_Cluster>(
                    null
                    );

                try
                {
                    var r = cluster.Get(typeof(IB));

                    Assert.Fail("test fails, this line should never be executed");
                }
                catch (DpdtException excp)
                    when(excp.Type == DpdtExceptionTypeEnum.NoBindingAvailable && excp.AdditionalArgument == typeof(IB).FullName)
                    {
                        //it's ok
                    }

                try
                {
                    var rs = cluster.GetAll(typeof(IB)).ToList();

                    Assert.Fail("test fails, this line should never be executed");
                }
                catch (DpdtException excp)
                    when(excp.Type == DpdtExceptionTypeEnum.NoBindingAvailable && excp.AdditionalArgument == typeof(IB).FullName)
                    {
                        //it's ok
                    }
            }
コード例 #9
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeConstantNonGenericSingleInterfaceSingleObject_Cluster>(
                    null
                    );

                var a0 = (IA)cluster.Get(typeof(IA));

                Assert.IsNotNull(a0);
                Assert.AreSame(AInstance, a0);

                var a1 = (IA)cluster.Get(typeof(IA));

                Assert.IsNotNull(a1);
                Assert.AreSame(AInstance, a1);
            }
コード例 #10
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeSingletonGenericSingleInterfaceSingleObject_Cluster>(
                    null
                    );

                var a0 = cluster.Get <IA>();

                Assert.IsNotNull(a0);

                var a1 = cluster.Get <IA>();

                Assert.IsNotNull(a1);

                Assert.AreSame(a0, a1);
            }
コード例 #11
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <FactoryComplex0_Cluster>(
                    null
                    );

                var af = cluster.Get <IAFactory>();

                Assert.IsNotNull(af);

                var a0 = af.Create(A);

                Assert.IsNotNull(a0);
                Assert.AreEqual(a0.A, A);
                Assert.AreEqual(a0.B, B);
                Assert.IsNotNull(a0.C);

                var a1 = af.Create(A);

                Assert.IsNotNull(a1);
                Assert.AreEqual(a1.A, A);
                Assert.AreEqual(a1.B, B);
                Assert.IsNotNull(a1.C);

                Assert.AreNotSame(a0, a1);

                Assert.AreSame(a0.C, a1.C);
            }
コード例 #12
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <WrapperFuncSingleton_Cluster>(
                    null
                    );

                var a0 = cluster.Get <IA>();

                Assert.IsNotNull(a0);

                var af1 = cluster.Get <Func <IA> >();

                Assert.IsNotNull(af1);
                var a1 = af1();

                Assert.AreSame(a0, a1);
            }
コード例 #13
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <WrapperFuncGenericSingleInterfaceSingleObject_Cluster>(
                    null
                    );

                var a0 = cluster.Get <IA>();

                Assert.IsNotNull(a0);

                var af1 = cluster.Get <Func <IA> >();

                Assert.IsNotNull(af1);
                var a1 = af1();

                Assert.AreNotSame(a0, a1);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <WrapperFuncNonGenericSingleInterfaceSingleObject_Cluster>(
                    null
                    );

                var a0 = (IA)cluster.Get(typeof(IA));

                Assert.IsNotNull(a0);

                var af1 = (Func <IA>)cluster.Get(typeof(Func <IA>));

                Assert.IsNotNull(af1);
                var a1 = af1();

                Assert.AreNotSame(a0, a1);
            }
コード例 #15
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeCustomNonGenericSingleObject_Cluster>(
                    null
                    );

                try
                {
                    var a0 = cluster.Get(typeof(IA));

                    Assert.Fail("This line should never be executed");
                }
                catch (DpdtException excp)
                    when(excp.Type == DpdtExceptionTypeEnum.CustomScopeObjectDoesNotFound && excp.AdditionalArgument == typeof(A).FullName)
                    {
                        //this is ok, test is green
                    }

                var scope1 = cluster.CreateCustomScope();
                var scope2 = cluster.CreateCustomScope();

                var a1 = (IA)cluster.Get(typeof(IA), scope1);

                Assert.IsNotNull(a1);
                Assert.IsFalse(a1.Disposed);

                var a2 = (IA)cluster.Get(typeof(IA), scope2);

                Assert.IsNotNull(a2);
                Assert.IsFalse(a2.Disposed);

                Assert.AreNotSame(a1, a2);

                var a1_2 = (IA)cluster.Get(typeof(IA), scope1);

                Assert.IsNotNull(a1_2);
                Assert.AreSame(a1, a1_2);

                scope1.Dispose();
                Assert.IsTrue(a1.Disposed);
                Assert.IsFalse(a2.Disposed);

                scope2.Dispose();
                Assert.IsTrue(a2.Disposed);
            }
コード例 #16
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeConstantTargetF0_Cluster>(
                    );

                var s = cluster.Get <string>();

                Assert.IsNotNull(s);
            }
コード例 #17
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeSingletonGenericTwoInterfacesSingleObject_Cluster>(
                    null
                    );

                var a0 = cluster.Get <IA0>();

                Assert.IsNotNull(a0);
                Assert.IsTrue(a0.GetType() == typeof(A));

                var a1 = cluster.Get <IA1>();

                Assert.IsNotNull(a1);
                Assert.IsTrue(a1.GetType() == typeof(A));

                Assert.AreSame(a0, a1);
            }
コード例 #18
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedGenericInterface_Cluster>(
                    null
                    );

                var a = cluster.Get <To <string> >();

                Assert.IsNotNull(a);
            }
コード例 #19
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeConstantTargetRO0_Cluster>(
                    );

                var s = cluster.Get <string>();

                Assert.IsNotNull(s);
                Assert.AreEqual("readonly string", s);
            }
コード例 #20
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedDynamic1_Cluster>(
                    null
                    );

                var a = cluster.Get <A>();

                Assert.IsNotNull(a);
            }
コード例 #21
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedCustomNamespace_Cluster>(
                    null
                    );

                var a = cluster.Get <A>();

                Assert.IsNotNull(a);
            }
コード例 #22
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedPlainArray1_Cluster>(
                    null
                    );

                var a = cluster.Get <A>();

                Assert.IsNotNull(a);
                Assert.IsTrue(ReferenceEquals(Constant, a.Constant));
            }
コード例 #23
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedNativeNumber0_Cluster>(
                    null
                    );

                var a = cluster.Get <A>();

                Assert.IsNotNull(a);
                Assert.AreEqual(Constant, a.Constant);
            }
コード例 #24
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedNativeTypeArgument0_Cluster>(
                    null
                    );

                var a = cluster.Get <IA>();

                Assert.IsNotNull(a);
                Assert.AreEqual(DefaultMessage, a.Message);
            }
コード例 #25
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedTwoBindMethods_Cluster>(
                    null
                    );

                var a = cluster.Get <IA>();

                Assert.IsNotNull(a);
                Assert.AreEqual(DefaultMessage, a.Message);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeTransientGenericSingleObjectDefinedArgument_Cluster>(
                    null
                    );

                var a0 = cluster.Get <IA>();

                Assert.IsNotNull(a0);
                Assert.AreEqual(CustomMesage, a0.Message);
            }
コード例 #27
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedGetAllDuplicate1_Cluster>(
                    null
                    );

                var hc = cluster.Get <HandlerContainer>();

                Assert.IsNotNull(hc);
                Assert.AreEqual(2, hc.Handlers.Count());
            }
コード例 #28
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <SettingsConstructorSubsetAndOrderTwo_Cluster>(
                    null
                    );

                var a = cluster.Get <A>();

                Assert.IsNotNull(a);
                Assert.AreEqual(3, a.ConstructorNumber);
            }
コード例 #29
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedComplexTypeArgument0_Cluster>(
                    null
                    );

                var a = cluster.Get <IA>();

                Assert.IsNotNull(a);
                Assert.AreEqual(Payload.PayloadString, a.Message);
            }
コード例 #30
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedOptionalArgument0_Cluster>(
                    null
                    );

                var a = cluster.Get <IA>();

                Assert.IsNotNull(a);
                Assert.AreEqual(CustomMessage, a.Message);
            }