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));
                }
            }
예제 #2
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<GetAllNonGenericSingleObject_Cluster>(
                    null
                    );

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

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

                Assert.IsNotNull(handlers);
                Assert.AreEqual(2, handlers.Count);
            }
예제 #5
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));
            }
            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)));
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ConventionsFromSingleInterface1_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a);
                Assert.AreEqual(2, a.Count);
                Assert.IsTrue(a.Any(aa => aa.GetType() == typeof(A0)));
                Assert.IsTrue(a.Any(aa => aa.GetType() == typeof(A2)));
            }
예제 #8
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <GetAllGenericHierarchy2Conditional_Cluster>(
                    null
                    );

                var alist = cluster.GetAll <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)));
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <GetAllGenericNoBinding_Cluster>(
                    null
                    );

                try
                {
                    var a0 = cluster.GetAll <IA>();
                    Assert.Fail("this line should never be executed");
                }
                catch (DpdtException excp)
                    when(excp.Type == DpdtExceptionTypeEnum.NoBindingAvailable && excp.AdditionalArgument == typeof(IA).FullName)
                    {
                        //this is ok
                    }
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ConditionalGenericHierarchy3First_Cluster>(
                    null
                    );

                var c0 = cluster.Get <IC>();

                Assert.IsNotNull(c0);
                Assert.IsNotNull(c0.B);
                Assert.AreEqual(Message, c0.B.Message);
                Assert.IsNotNull(c0.B.A);

                var cc = cluster.GetAll <IC>();

                Assert.IsNotNull(cc);
                Assert.AreEqual(1, cc.Count);
                Assert.AreSame(c0, cc[0]);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ConditionalNonGenericHierarchy3Second_Cluster>(
                    null
                    );

                var c0 = (IC)cluster.Get(typeof(IC));

                Assert.IsNotNull(c0);
                Assert.IsNotNull(c0.B);
                Assert.AreEqual(Message, c0.B.Message);
                Assert.IsNotNull(c0.B.A);

                var cc = (List <IC>)cluster.GetAll(typeof(IC));

                Assert.IsNotNull(cc);
                Assert.AreEqual(1, cc.Count);
                Assert.AreSame(c0, cc[0]);
            }