Beispiel #1
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);
            }
            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);
            }
Beispiel #3
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeSingletonFastSingleInterfaceSingleObject_Cluster>(
                    null
                    );

                var a0 = cluster.GetFast(default(IA));

                Assert.IsNotNull(a0);

                var a1 = cluster.GetFast(default(IA));

                Assert.IsNotNull(a1);

                Assert.AreSame(a0, a1);
            }
Beispiel #4
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeSingletonFastTwoInterfacesSingleObject_Cluster>(
                    null
                    );

                var a0 = cluster.GetFast(default(IA0));

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

                var a1 = cluster.GetFast(default(IA1));

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

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

                var a = cluster.GetFast(default(IA));

                Assert.IsNotNull(a);

                var b0 = cluster.GetFast(default(IB));

                Assert.IsNotNull(b0);
                Assert.IsNotNull(b0.A);

                Assert.AreSame(a, b0.A);

                var b1 = cluster.GetFast(default(IB));

                Assert.IsNotNull(b1);
                Assert.IsNotNull(b1.A);
                Assert.AreSame(b0, b1);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <ScopeConstantTargetInPlace1_Cluster>(
                    null
                    );

                var ul0 = cluster.Get <ulong>();

                Assert.IsNotNull(ul0);
                Assert.AreEqual(123456789UL, ul0);

                var ul1 = cluster.Get(typeof(ulong));

                Assert.IsNotNull(ul1);
                Assert.AreEqual(123456789UL, ul1);

                var ul2 = cluster.GetFast(default(ulong));

                Assert.IsNotNull(ul2);
                Assert.AreEqual(123456789UL, ul2);
            }
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <UnsortedBindFrom3And4_Cluster>(
                    null
                    );

                #region check for 3 bind from

                var aclass012_0 = cluster.GetFast(default(IAInterface0));
                Assert.IsNotNull(aclass012_0);
                var aclass012_1 = cluster.GetFast(default(IAInterface1));
                Assert.IsNotNull(aclass012_1);
                var aclass012_2 = cluster.GetFast(default(IAInterface2));
                Assert.IsNotNull(aclass012_2);

                Assert.AreSame(aclass012_0, aclass012_1);
                Assert.AreSame(aclass012_1, aclass012_2);

                #endregion

                #region check for 4 bind from

                var bclass0123_0 = cluster.GetFast(default(IBInterface0));
                Assert.IsNotNull(bclass0123_0);
                var bclass0123_1 = cluster.GetFast(default(IBInterface1));
                Assert.IsNotNull(bclass0123_1);
                var bclass0123_2 = cluster.GetFast(default(IBInterface2));
                Assert.IsNotNull(bclass0123_2);
                var bclass0123_3 = cluster.GetFast(default(IBInterface3));
                Assert.IsNotNull(bclass0123_3);

                Assert.AreSame(bclass0123_0, bclass0123_1);
                Assert.AreSame(bclass0123_1, bclass0123_2);
                Assert.AreSame(bclass0123_2, bclass0123_3);

                #endregion
            }