Ejemplo n.º 1
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);
            }
Ejemplo n.º 2
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);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ConventionsFrom2Interfaces0_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a);
                Assert.AreEqual(3, a.Count);
                Assert.IsTrue(a.Any(aa => aa.GetType() == typeof(A0)));
                Assert.IsTrue(a.Any(aa => aa.GetType() == typeof(A1)));
                Assert.IsTrue(a.Any(aa => aa.GetType() == typeof(A2)));

                var b = cluster.GetAll <IB>();

                Assert.IsNotNull(b);
                Assert.AreEqual(3, b.Count);
                Assert.IsTrue(b.Any(bb => bb.GetType() == typeof(A0)));
                Assert.IsTrue(b.Any(bb => bb.GetType() == typeof(A1)));
                Assert.IsTrue(b.Any(bb => bb.GetType() == typeof(A2)));

                foreach (var pair in a.OrderBy(t => t.GetType().Name).Zip(b.OrderBy(t => t.GetType().Name)))
                {
                    Assert.IsTrue(ReferenceEquals(pair.First, pair.Second));
                }
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedDisposeAndException_Cluster>(
                    null
                    );

                var baseClass0 = cluster.GetFast(default(BaseClass));

                Assert.IsFalse(baseClass0.Disposed);

                try
                {
                    cluster.GetFast(default(DerivedClass));

                    Assert.Fail("this line should never be executed");
                }
                catch (InvalidOperationException)
                {
                    //it's OK
                }

                var baseClass1 = cluster.GetFast(default(BaseClass));

                Assert.AreSame(baseClass0, baseClass1);
                Assert.IsFalse(baseClass1.Disposed);

                cluster.Dispose();
                Assert.IsTrue(baseClass1.Disposed);
            }
Ejemplo n.º 5
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
                    }
            }
            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);
            }
Ejemplo n.º 7
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedDisposeAndException2_Cluster>(
                    null
                    );

                var class1 = cluster.GetFast(default(Class1));

                Assert.IsFalse(class1.Disposed);

                var class2 = cluster.GetFast(default(Class2));

                Assert.IsFalse(class2.Disposed);

                try
                {
                    cluster.Dispose();

                    Assert.Fail("this line should never be executed");
                }
                catch (AggregateException)
                {
                    //it's ok
                }

                var dclass1 = cluster.GetFast(default(Class1));

                Assert.IsTrue(dclass1.Disposed);

                var dclass2 = cluster.GetFast(default(Class2));

                Assert.IsTrue(dclass2.Disposed);
            }
Ejemplo n.º 8
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 <ScopeConstantTargetF0_Cluster>(
                    );

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

                Assert.IsNotNull(s);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeConstantTargetRO0_Cluster>(
                    );

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

                Assert.IsNotNull(s);
                Assert.AreEqual("readonly string", s);
            }
Ejemplo n.º 11
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedDynamic1_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedGenericInterface_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a);
            }
Ejemplo n.º 13
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedCustomNamespace_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedOptionalArgument0_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a);
                Assert.AreEqual(CustomMessage, a.Message);
            }
Ejemplo n.º 15
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 <SettingsConstructorAllAndOrderTwo_Cluster>(
                    null
                    );

                var b = cluster.Get <B>();

                Assert.IsNotNull(b);
                Assert.AreEqual(6, b.ConstructorNumber);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeConstantTargetInPlace0_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(s);
                Assert.AreEqual("my const string", s);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeTransientGenericSingleObjectDefinedArgument_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a0);
                Assert.AreEqual(CustomMesage, a0.Message);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedGetAllDuplicate1_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(hc);
                Assert.AreEqual(2, hc.Handlers.Count());
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedNativeTypeArgument0_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a);
                Assert.AreEqual(DefaultMessage, a.Message);
            }
Ejemplo n.º 21
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);
            }
Ejemplo n.º 22
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <SettingsConstructorSubsetAndOrderTwo_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a);
                Assert.AreEqual(3, a.ConstructorNumber);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedGetAllDuplicate0_Cluster>(
                    null
                    );

                var handlers = cluster.GetAll <IHandler>();

                Assert.IsNotNull(handlers);
                Assert.AreEqual(2, handlers.Count);
            }
Ejemplo n.º 24
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));
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedNativeNumber0_Cluster>(
                    null
                    );

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

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

                var alist = (List<IA>) cluster.GetAll(typeof(IA));
                Assert.IsNotNull(alist);
                Assert.AreEqual(1, alist.Count);
                Assert.IsNotNull(alist[0]);
            }
Ejemplo n.º 27
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <GetAllGenericTwoObjectsConditional0_Cluster>(
                    null
                    );

                var alist = cluster.GetAll <IA>();

                Assert.IsNotNull(alist);
                Assert.AreEqual(1, alist.Count);
                Assert.IsTrue(alist[0].ImplementationType == typeof(A1));
            }
Ejemplo n.º 28
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedMirroredArguments0_Cluster>(
                    null
                    );

                var myclass = cluster.Get <MyClass>();

                Assert.IsNotNull(myclass);
                Assert.AreEqual(10, myclass.A);
                Assert.AreEqual(100, myclass.B);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <GetAllNonGenericTwoObjects_Cluster>(
                    null
                    );

                var alist = (List <IA>)cluster.GetAll(typeof(IA));

                Assert.IsNotNull(alist);
                Assert.AreEqual(2, alist.Count);
                Assert.IsTrue(alist.Any(a => a.ImplementationType == typeof(A0)));
                Assert.IsTrue(alist.Any(a => a.ImplementationType == typeof(A1)));
            }
Ejemplo n.º 30
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ActivationExcessiveTooManyRoots2_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a);

                Assert.AreEqual(1, A1.ActivationCount, "A1.ActivationCount");
                Assert.AreEqual(0, A2.ActivationCount, "A2.ActivationCount");
            }