コード例 #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);
            }
コード例 #2
0
            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);
            }
コード例 #3
0
            public void PerformClusterTesting()
            {
                var cluster = new FakeCluster <SingletonDispose_Cluster>(
                    null
                    );

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

                Assert.IsNotNull(a0);

                Assert.AreEqual(0, A.DisposeCount);

                cluster.Dispose();

                Assert.AreEqual(1, A.DisposeCount);
            }