コード例 #1
0
ファイル: Program.cs プロジェクト: hszilu1020/study
        static void Main(string[] args)
        {
            #region 简单工厂模式

            Console.WriteLine("当前模式:{0}", "简单工厂模式");

            Test2.Test();

            Console.WriteLine("--------------------------------------------");

            #endregion

            #region 工厂方法模式

            Console.WriteLine("当前模式:{0}", "工厂方法模式");

            Test3.Test();

            Console.WriteLine("--------------------------------------------");

            #endregion

            #region 抽象工厂模式



            #endregion



            Console.ReadKey();
        }
コード例 #2
0
    public virtual void Init(RichTextBox outputText)
    {
        m_output_text = outputText;

        // clear log
        File.WriteAllText(m_log_path, String.Empty);

        Test1 testCase1 = new Test1();

        m_tests.Add(testCase1);

        Test2 testCase2 = new Test2();

        m_tests.Add(testCase2);

        Test3 testCase3 = new Test3();

        m_tests.Add(testCase3);

        Test4 testCase4 = new Test4();

        m_tests.Add(testCase4);

        Test5 testCase5 = new Test5();

        m_tests.Add(testCase5);

        Test6 testCase6 = new Test6();

        m_tests.Add(testCase6);
    }
コード例 #3
0
ファイル: new2.cs プロジェクト: ForNeVeR/pnet
    void m1()
    {
        int    i1;
        Color  c1;
        Test2  t2;
        Test3  t3;
        Test4  t4;
        Object o1;
        J      j1;

        Object[] ao1;

        // Need a type to create objects.
        i1 = new Color.Red();

        // Cannot instantiate interfaces or abstract classes.
        j1 = new J();
        t3 = new Test3();

        // The type must be a class or value type.
        ao1 = new Object[] ();

        // Inaccessible constructor.
        t4 = new Test4();

        // No candidates.
        t2 = new Test2(0.1);
    }
コード例 #4
0
        static void Main2(string[] args)
        {
            Test  test  = new Test();
            Test2 test2 = new Test2();
            Test3 test3 = new Test3();

            Console.WriteLine(test.Power(10));
            Console.WriteLine(test.Power(20));
            Console.WriteLine(test2.Multi(52, 273));
            Console.WriteLine(test2.Multi(103, 32));
            test3.Print();
            test3.Print();

            Test4 test4 = new Test4();

            Console.WriteLine(test4.Sum(1, 100));

            Test5 test5 = new Test5();

            Console.WriteLine(test5.Multiply(1, 10));

            Random random = new Random();

            Console.WriteLine(random.Next(10, 100));
            Console.WriteLine(random.Next(10, 100));
            Console.WriteLine(random.Next(10, 100));
            Console.WriteLine(random.Next(10, 100));
            Console.WriteLine(random.Next(10, 100));
            Console.WriteLine(random.Next(10, 100));
        }
コード例 #5
0
        public void TestArrayContents()
        {
            Test3[] arr = new Test3[]
            {
                new Test3 {
                    C = new Test1 {
                        A = 123
                    }
                },
                new Test3 {
                    C = new Test1 {
                        A = 456
                    }
                },
                new Test3 {
                    C = new Test1 {
                        A = 789
                    }
                }
            };

            var clone = Serializer.DeepClone(arr);

            CheckLists(arr, clone);
        }
コード例 #6
0
ファイル: Clone.cs プロジェクト: sagifogel/Ramda.NET
        public void Clone_Clones_Objects_With_Circular_References()
        {
            dynamic clone;
            dynamic dynamicX;
            var     x = new Test {
                c = (object)null
            };
            var y = new Test2 {
                a = x
            };
            var z = new Test3 {
                b = y
            };

            x.c      = z;
            dynamicX = x;
            clone    = (Test)R.Clone(x);

            Assert.AreNotSame(x, clone);
            Assert.AreNotSame(x.c, clone.c);
            Assert.AreNotSame(((dynamic)x).c.b, clone.c.b);
            Assert.AreNotSame(((dynamic)x).c.b.a, clone.c.b.a);
            Assert.AreNotSame(((dynamic)x).c.b.a.c, clone.c.b.a.c);
            Assert.AreNotSame(R.Keys(clone), R.Keys(x));
            Assert.AreNotSame(R.Keys(clone.c), R.Keys(x.c));
            Assert.AreNotSame(R.Keys(clone.c.b), R.Keys(dynamicX.c.b));
            Assert.AreNotSame(R.Keys(clone.c.b.a), R.Keys(dynamicX.c.b.a));
            Assert.AreNotSame(R.Keys(clone.c.b.a.c), R.Keys(dynamicX.c.b.a.c));

            dynamicX.c.b = 1;

            Assert.AreNotEqual(dynamicX.c.b, clone.c.b);
        }
コード例 #7
0
        static void Main(string[] args)
        {
            IUnique monoType = null;
            monoType.DoSomething();

            var test = new Test();
            test.DoTest();

            var test3 = new Test3();

            test3.DoTest();

            var c2 = new LocalClass2();
            c2.Bar();

            var c3 = new RemoteClass1();
            c3.Bar();

            test.CallBar(c3); // Recall type(c3) = RemoteClass1

            #region Demo Delegates
            TestDelegate.Test();
            TestDelegate.Test2();
            #endregion
        }
コード例 #8
0
 static int Main()
 {
     return(100 +
            (Test1.Run() == 0 ? 0 : 1) +
            (Test2.Run() == 1 ? 0 : 2) +
            (Test3.Run() == 0 ? 0 : 4) +
            (Test4.Run() == 0 ? 0 : 8));
 }
コード例 #9
0
ファイル: SimpleInterface4.cs プロジェクト: frje/SharpLang
    public static void Main()
    {
        ITest <string> test2 = new Test2();
        ITest <string> test3 = new Test3();

        System.Console.WriteLine(test2.A());
        System.Console.WriteLine(test3.A());
    }
コード例 #10
0
        public void TestToMethod()
        {
            var test3 = new Test3();

            Container.BindIFactory <ITest>().ToMethod(c => test3);

            Assert.That(ReferenceEquals(test3, Container.Resolve <IFactory <ITest> >().Create()));
        }
コード例 #11
0
 void Direct()
 {
     t1 = GetComponent <Test1>();
     t2 = GetComponent <Test2>();
     t3 = GetComponent <Test3>();
     t4 = GetComponent <Test4>();
     t5 = GetComponent <Test5>();
 }
コード例 #12
0
 public void TestArrayBytes()
 {
     Test3[] list = new Test3[] { new Test3 {
                                      C = new Test1 {
                                          A = 150
                                      }
                                  } };
     Assert.IsTrue(Program.CheckBytes(list, 0x0A, 0x05, 0x1a, 0x03, 0x08, 0x96, 0x01));
 }
コード例 #13
0
 public void TestInit()
 {
     _mockCacheProvider = Substitute.For <ICacheProvider>();
     _manager           = new DefaultCacheManager(_mockCacheProvider, new DefaultCacheKey());
     _mockRepository    = Substitute.For <ITest3Repository>();
     _key      = "a";
     _cacheKey = "CacheKey_a";
     _signKey  = "CacheKey_Sign_a";
     _testA    = Test3.CreateA();
 }
コード例 #14
0
        public void Test3Type_CanBeTypeMatchedUsingWhereExpressionAndDoValue()
        {
            ITest test   = new Test3();
            var   result = test.TypeMatch().To <int>()
                           .CaseOf <Test3>().Where(t => t.F2() == 2).Do(2)
                           .CaseOf <Test3>().Where(t => t.F2() == 3).Do(3)
                           .Result();

            Assert.AreEqual(3, result);
        }
コード例 #15
0
    int Check()
    {
        if (Test1("1", "5") != "1|5")
        {
            return(1);
        }

        Test2(6);
        if (value != 6)
        {
            return(2);
        }

        if (Test3(9) () != 9)
        {
            return(3);
        }

        string s = this;

        if (s != "op")
        {
            return(4);
        }

        if (Prop != "f-1 f=2")
        {
            return(5);
        }

        if (Prop2() != "n1")
        {
            return(6);
        }

        if (this [13, 20] != 7)
        {
            return(7);
        }

        return(0);
    }
コード例 #16
0
        public void ObjectArray()
        {
            var o = new Test3 {
                Value = 6
            };
            var x = new object?[] { 1, "asd", o, o, new Test2 {
                                        Value = 7
                                    }, null, new object[] { 1, "zxc" } };

            RoundTrip(x);
        }
コード例 #17
0
        public void Test3Type_CanBeTypeMatchedUsingITest()
        {
            ITest test   = new Test3();
            var   result = test.TypeMatch().To <int>()
                           .CaseOf <Test3>().Do(t => t.F2())
                           .CaseOf <Test2>().Do(t => t.F2())
                           .CaseOf <Test1>().Do(t => t.F1())
                           .Result();

            Assert.AreEqual(3, result);
        }
コード例 #18
0
        public void Test3Type_CanBeTypeMatchedUsingITestAndDoValue()
        {
            ITest test   = new Test3();
            var   result = test.TypeMatch().To <int>()
                           .CaseOf <Test3>().Do(3)
                           .CaseOf <Test2>().Do(2)
                           .CaseOf <Test1>().Do(1)
                           .Result();

            Assert.AreEqual(3, result);
        }
コード例 #19
0
ファイル: N1969.cs プロジェクト: zwmyint/Bridge
        public void TestStaticConstructorsForBaseClasses()
        {
            Bridge1969.buffer = "";
            Test3.Foo();
            Assert.AreEqual("Test3", Bridge1969.buffer);

            Bridge1969.buffer = "";
            var test = new Test3();

            Assert.AreEqual("Test2Test1", Bridge1969.buffer);
        }
コード例 #20
0
 public void TestArrayBytes()
 {
     Test3[] list = new Test3[] { new Test3 {
                                      C = new Test1 {
                                          A = 150
                                      }
                                  } };
     Serializer.DeepClone(list);
     // variant?
     //Assert.IsTrue(Program.CheckBytes(list, 0x0A, 0x09, 0x1a, 0x07, 0x10, 0x01, 0x52, 0x03, 0x08, 0x96, 0x01));
 }
コード例 #21
0
    public static void Main()
    {
        ITest test1 = new Test1();
        ITest test2 = new Test2();
        ITest test3 = new Test3();
        ITest test4 = new Test4();

        System.Console.WriteLine(test1.A());
        System.Console.WriteLine(test2.A());
        System.Console.WriteLine(test3.A());
        System.Console.WriteLine(test4.A());
    }
コード例 #22
0
    public static void Main()
    {
        ITest test1 = new Test1();
        ITest test2 = new Test2();
        ITest test3 = new Test3();
        ITest test4 = new Test4();

        System.Console.WriteLine(test1.A());
        System.Console.WriteLine(test2.A());
        System.Console.WriteLine(test3.A());
        System.Console.WriteLine(test4.A());
    }
コード例 #23
0
        public void TestInterface2()
        {
            var target = new MessageMediator();
            var tc     = new Test3();

            target.Register(tc);

            bool hadTarget = target.SendMessage <IData>(new Data("Test"));

            Assert.AreEqual(true, hadTarget, "Mediator did not find target");
            Assert.AreEqual <int>(1, tc.Count);
        }
コード例 #24
0
    static int Main()
    {
        bool passed = true;

        ulong result1         = Test1.Run();
        ulong expectedResult1 = 64537;

        if (result1 != expectedResult1)
        {
            passed = false;
            Console.WriteLine(String.Format("Failed Test1: expected = {0}, actual = {1}", expectedResult1, result1));
        }

        S0  vr45            = new S0(0, 0, 0);
        int result2         = Test2.Run(vr45);
        int expectedResult2 = 65487;

        if (result2 != expectedResult2)
        {
            passed = false;
            Console.WriteLine(String.Format("Failed Test2: expected = {0}, actual = {1}", expectedResult2, result2));
        }

        int result3         = Test3.Run();
        int expectedResult3 = 65535;

        if (result3 != expectedResult3)
        {
            passed = false;
            Console.WriteLine(String.Format("Failed Test3: expected = {0}, actual = {1}", expectedResult3, result3));
        }

        uint result4         = Test4.Run();
        uint expectedResult4 = 32779;

        if (result4 != expectedResult4)
        {
            passed = false;
            Console.WriteLine(String.Format("Failed Test4: expected = {0}, actual = {1}", expectedResult4, result4));
        }

        if (passed)
        {
            Console.WriteLine("PASSED");
            return(100);
        }
        else
        {
            Console.WriteLine("FAILED");
            return(-1);
        }
    }
コード例 #25
0
ファイル: Test.cs プロジェクト: Maciej-Poleski/Programowanie
        public static void Main()
        {
            Test0.Test();
            Console.WriteLine();
            Test1.Test();
            Console.WriteLine();
            Test2.Test();
            Console.WriteLine();
            Test3.Test();
            Console.WriteLine();

            Console.ReadKey();
        }
コード例 #26
0
        public void GivenTest3_generatesExpectedResult_sub2()
        {
            var tst3 = new Test3();
            var spnl = (StackPanel)tst3.Content;

            var ctxt = (CTextBlock)spnl.Children[2];
            var info = new MetryHolder(ctxt, 1000, 1000);

            Approvals.Verify(
                new ApprovalImageWriter(info.Image),
                Approvals.GetDefaultNamer(),
                new DiffToolReporter(DiffEngine.DiffTool.WinMerge));
        }
コード例 #27
0
        public void TestCollectionInitializerWithStaticMember()
        {
            var list1 = Test1.GetList();
            var list2 = Test2.GetList();
            var list3 = new Test3().GetList();

            Assert.AreEqual(1, list1.Count);
            Assert.AreEqual("Const", list1[0]);

            Assert.AreEqual(1, list2.Count);
            Assert.AreEqual(1, list2[0]);

            Assert.AreEqual(1, list3.Count);
            Assert.AreEqual(1, list3[0]);
        }
コード例 #28
0
ファイル: Test.cs プロジェクト: Maciej-Poleski/Programowanie
        static void Main()
        {
            Test0.Test(new string[0]);
            Console.WriteLine();
            Test1.Test(new string[0]);
            Console.WriteLine();
            Test2.Test();
            Console.WriteLine();
            Test3.Test();
            Console.WriteLine();
            Test4.Test();
            Console.WriteLine();

            Console.ReadKey();
        }
コード例 #29
0
ファイル: classGenericTest.cs プロジェクト: Dblind/LearnCode
    public static void MainCat()
    {
        List <Cat>           list    = new List <Cat>();
        IEnumerable <Cat>    cats    = list;
        IEnumerable <Animal> animals = cats;

        object[] objects = new string[3];
        objects[0] = "aaa";
        //objects[1] = 1;
        //objects[2] = new Cat();

        Lada            lada        = new Lada();
        Test3           cat         = new Test3();
        ICar <V8Engine> V8EngineCar = lada;
        ICar <Engine>   engine      = lada;
    }
コード例 #30
0
        public void OnGet_WithAddInstance_ItShouldResolveTheSameInstance()
        {
            //Arrange
            var subject          = new ServiceProvider();
            var expectedInstance = new Test3();

            subject.Add <ITest1, Test1>();
            subject.Add <ITest2, Test2>();
            subject.Add <ITest3>(expectedInstance);

            //Act
            var result = subject.Get <ITest3>();

            //Assert
            Assert.Same(expectedInstance, result);
        }
コード例 #31
0
    public void Deep_Clone_Array_Property()
    {
        var test1 = new Test3 {
            MyTest1 = new object[] { new Test1(), new Test1() }
        };

        var clone = (Test3)test1.DeepClone();

        Assert.AreNotSame(test1, clone);
        Assert.AreEqual(test1.MyTest1.Length, clone.MyTest1.Length);
        for (var i = 0; i < test1.MyTest1.Length; i++)
        {
            Assert.IsNotNull(clone.MyTest1.ElementAt(i));
            Assert.AreNotSame(clone.MyTest1.ElementAt(i), test1.MyTest1.ElementAt(i));
        }
    }
コード例 #32
0
        public void Cannot_Deep_Clone_Collection_Properties_That_Are_Not_Cloneable()
        {
            var test1 = new Test3()
            {
                MyTest1 = new object[]
                {
                    new Test1(), "hello",
                    //not cloneable so this property will get skipped
                    new Test2()
                }
            };

            var clone = (Test3)test1.DeepClone();

            //it skipped this property so these will now be the same
            Assert.AreSame(clone.MyTest1, test1.MyTest1);
        }
コード例 #33
0
        static void Main()
        {

            Test1 a = new Test1();
            Test2 a1 = new Test2();
            Test3 a2 = new Test3();
            Mutex wait = new Mutex(false);
            MyThreadPool pool = new MyThreadPool(5, wait);
            for (int I = 0; I < 20; I++) pool.PutInQueue(new Test1());
               // pool.PutInQueue(a);
            //pool.PutInQueue(a1);
            //pool.PutInQueue(a2);
            Thread.Sleep(100);
            Console.ReadKey();
            pool.EndMyThreadPool();
            Console.ReadKey();
        }
コード例 #34
0
        public void Get_ClassWithIgnoreDataMemberAttr_Parsed()
        {
            var test = new Test3
            {
                Property1 = 1M,
                Property2 = "val",
                Property3 = _now,
                Property4 = "p4"
            };

            var outDic = _digger.Get(test);
            Assert.That(outDic.Count, Is.EqualTo(3));
            Assert.That(outDic["property_1"].PropertyNameSource, Is.EqualTo(PropertyNameSource.MixpanelName));
            Assert.That(outDic["property_1"].Value, Is.EqualTo(1M));
            Assert.That(outDic["Property3"].PropertyNameSource, Is.EqualTo(PropertyNameSource.Default));
            Assert.That(outDic["Property3"].Value, Is.EqualTo(_now));
            Assert.That(outDic["Property4"].PropertyNameSource, Is.EqualTo(PropertyNameSource.Default));
            Assert.That(outDic["Property4"].Value, Is.EqualTo("p4"));
        }
コード例 #35
0
ファイル: co3861recordfixup.cs プロジェクト: ArildF/masters
	public bool runTest()
	{
		Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer);
		int iCountErrors = 0;
		int iCountTestcases = 0;
		String strLoc = "Loc_000oo";
		ObjectManager objmgr1 = null;
		ISurrogateSelector isur = null;
		StreamingContext sc1 = new StreamingContext(StreamingContextStates.All);
		ObjectIDGenerator objid1 = null;
		TestFixup tstfxp1;
		Int64 iRootID;
		Int64 iChildID;
		String strValue;
		bool fFirstTime;
		MemberInfo[] members = null;
		Test1 tst1;
		A a1;
		Int32 iOurMan;
		Boolean fChildFound;
		Test2 tst2;
		Test3 tst3;
		B b1;
		try {
			do
			{
				tstfxp1 = new TestFixup();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tstfxp1, out fFirstTime);
				strValue = "Hello World";
				iChildID = objid1.GetId(strValue, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(tstfxp1.GetType());
				objmgr1 = new ObjectManager(isur, sc1);
				objmgr1.RecordFixup(iRootID, members[0], iChildID);
				objmgr1.RegisterObject(tstfxp1, iRootID);
				objmgr1.RegisterObject(strValue, iChildID);
				iCountTestcases++;
				if(!tstfxp1.strFixupValue.Equals(strValue))
				{
					iCountErrors++;
					Console.WriteLine("Err_753cd! Expected value not returned, " + tstfxp1.strFixupValue + ", expected, " + strValue);
				}
				objmgr1.DoFixups();
				iCountTestcases++;
				if(!tstfxp1.strFixupValue.Equals(strValue))
				{
					iCountErrors++;
					Console.WriteLine("Err_90342ddvs! Expected value not returned, " + tstfxp1.strFixupValue + ", expected, " + strValue);
				}
				tst1 = new Test1();
				a1 = new A();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tst1, out fFirstTime);
				iChildID = objid1.GetId(a1, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(typeof(Test1));
				iOurMan = -1;
				fChildFound=false;
				for(int i=0; i<members.Length;i++){
					if(members[i].Name.Equals("a")){
						fChildFound=true;
						iOurMan=i;
						break;
					}
				}
				if(!fChildFound)
				throw new Exception("Loc_342ds! didn't find the member");
				objmgr1 = new ObjectManager(isur, sc1);
				objmgr1.RecordFixup(iRootID, members[iOurMan], iChildID);
				try{
					iCountTestcases++;
					objmgr1.RegisterObject(a1, iChildID);
					objmgr1.RegisterObject(tst1, iRootID);
					objmgr1.DoFixups();
					Console.WriteLine("Loc_0283! exception not thrown");
					}catch(Exception ex){
					iCountErrors++;
					Console.WriteLine("Err_04523cd! Unexpected exception, " + ex.ToString());
				}
				tst1 = new Test1();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tst1, out fFirstTime);
				a1 = new A();
				iChildID = objid1.GetId(a1, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(typeof(Test1));
				iOurMan = -1;
				fChildFound=false;
				for(int i=0; i<members.Length;i++){
					if(members[i].Name.Equals("a")){
						fChildFound=true;
						iOurMan=i;
						break;
					}
				}
				if(!fChildFound)
				throw new Exception("Loc_342ds! didn't find the member");
				objmgr1 = new ObjectManager(isur, sc1);
				objmgr1.RecordFixup(iRootID, members[iOurMan], iChildID);
				try{
					iCountTestcases++;
					objmgr1.DoFixups();
					iCountErrors++;
					Console.WriteLine("Err_7453fd! exception not thrown");
					}catch(SerializationException){
					}catch(Exception ex){
					iCountErrors++;
					Console.WriteLine("Err_1204cd! Unexpected exception, " + ex.ToString());
				}
				tst1 = new Test1();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tst1, out fFirstTime);
				a1 = new A();
				iChildID = objid1.GetId(a1, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(typeof(Test1));
				iOurMan = -1;
				fChildFound=false;
				for(int i=0; i<members.Length;i++){
					if(members[i].Name.Equals("a")){
						fChildFound=true;
						iOurMan=i;
						break;
					}
				}
				if(!fChildFound)
				throw new Exception("Loc_342ds! didn't find the member");
				objmgr1 = new ObjectManager(isur, sc1);
				try{
					iCountTestcases++;
					objmgr1.RegisterObject(a1, iChildID);
					objmgr1.RegisterObject(tst1, iRootID);
					objmgr1.RecordFixup(iRootID, members[iOurMan], iChildID);
					objmgr1.DoFixups();
					Console.WriteLine("Loc_02843cd! exception not thrown");
					}catch(Exception ex){
					iCountErrors++;
					Console.WriteLine("Err_0438fd! Unexpected exception, " + ex.ToString());
				}
				tst1 = new Test1();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tst1, out fFirstTime);
				a1 = new A();
				iChildID = objid1.GetId(a1, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(typeof(Test1));
				iOurMan = -1;
				fChildFound=false;
				for(int i=0; i<members.Length;i++){
					if(members[i].Name.Equals("a")){
						fChildFound=true;
						iOurMan=i;
						break;
					}
				}
				if(!fChildFound)
				throw new Exception("Loc_342fsd! didn't find the member");
				objmgr1 = new ObjectManager(isur, sc1);
				try{
					iCountTestcases++;
					objmgr1.RegisterObject(a1, iChildID);
					objmgr1.RegisterObject(tst1, iRootID);
					objmgr1.DoFixups();
					Console.WriteLine("Loc_94523fsd! exception not thrown");
					}catch(Exception ex){
					iCountErrors++;
					Console.WriteLine("Err_0348dcs! Unexpected exception, " + ex.ToString());
				}
				tst2 = new Test2();
				tst3 = new Test3();
				b1 = new B();
				b1.StrValue = "Hello World";
				tst3.Set_B=b1;
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tst2, out fFirstTime);
				iChildID = objid1.GetId(tst3, out fFirstTime);
				members = FormatterServices.GetSerializableMembers(typeof(Test2));
				iOurMan = -1;
				fChildFound=false;
				for(int i=0; i<members.Length;i++){
					if(members[i].Name.Equals("tst3")){
						fChildFound=true;
						iOurMan=i;
						break;
					}
				}
				if(!fChildFound)
				throw new Exception("Loc_024fd! didn't find the member");
				objmgr1 = new ObjectManager(isur, sc1);
				objmgr1.RecordFixup(iRootID, members[iOurMan], iChildID);
				objmgr1.RegisterObject(tst2, iRootID);
				objmgr1.RegisterObject(tst3, iChildID);
				iCountTestcases++;
				Console.WriteLine("Loc_4523vfd! we hve, " + tst2.StrValue);
				if(!tst2.StrValue.Equals("Hello World"))
				{
					iCountErrors++;
					Console.WriteLine("Err_038qm! Expected value not returned, " + tst2.StrValue);
				}
				tstfxp1 = new TestFixup();
				objid1 = new ObjectIDGenerator();
				iRootID = objid1.GetId(tstfxp1, out fFirstTime);
				strValue = "Hello World";
				members = FormatterServices.GetSerializableMembers(tstfxp1.GetType());
				objmgr1 = new ObjectManager(null, sc1);
				objmgr1.RecordFixup(iRootID, members[0], iRootID);
				try{
					iCountTestcases++;
					objmgr1.RegisterObject(tstfxp1, iRootID);
					iCountErrors++;
					Console.WriteLine("Err_753cd! exception not thrown");
					}catch(ArgumentException){
					}catch(Exception ex){
					iCountErrors++;
					Console.WriteLine("Err_04523cd! Unexpected exception, " + ex.ToString());
				}
				try
				{
					iCountTestcases++;
					objmgr1.RecordFixup(-1, members[0], iChildID);
					iCountErrors++;
					Console.WriteLine("Err_034cd! exception not thrown");
				}
				catch(ArgumentOutOfRangeException){}
				catch(Exception ex)
				{
					iCountErrors++;
					Console.WriteLine("Err_034cd! Unexpected exception, " + ex.ToString());
				}
				try
				{
					iCountTestcases++;
					objmgr1.RecordFixup(iRootID, members[0], -5);
					iCountErrors++;
					Console.WriteLine("Err_037csd! exception not thrown");
				}
				catch(ArgumentOutOfRangeException){}
				catch(Exception ex)
				{
					iCountErrors++;
					Console.WriteLine("Err_710ca! Unexpected exception, " + ex.ToString());
				}
				try
				{
					iCountTestcases++;
					objmgr1.RecordFixup(iRootID, null, iChildID);
					iCountErrors++;
					Console.WriteLine("Err_048cs! exception not thrown");
				}
				catch(ArgumentNullException){}
				catch(Exception ex)
				{
					iCountErrors++;
					Console.WriteLine("Err_079cd! Unexpected exception, " + ex.ToString());
				}
			} while (false);
			} catch (Exception exc_general ) {
			++iCountErrors;
			Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general==\n"+exc_general.StackTrace);
		}
		if ( iCountErrors == 0 )
		{
			Console.WriteLine( "paSs.   "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
			return true;
		}
		else
		{
			Console.WriteLine("FAiL!   "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
			return false;
		}
	}
コード例 #36
0
ファイル: sample021.cs プロジェクト: basyura/cs_sample
 static void Main(string[] args)
 {
     Test1 t1 = new Test1();
     Test2 t2 = new Test2();
     Test3 t3 = new Test3();
 }
コード例 #37
0
 public void Initialize(Test3 other)
 {
     this.Other = other;
 }