示例#1
0
        static void Main(string[] args)
        {
            // value type tests
            CloneTest(ValueTypeTest.CreateInteger());

            CloneTest(ValueTypeTest.CreateBook());


            // reference type tests
            CloneTest(ReferenceTypeTest.CreateString());

            CloneTest(ReferenceTypeTest.CreateBaseTestClass());

            CloneTest(ReferenceTypeTest.CreateDerivedTestClass());


            CloneListTest(Helper.CreateItems(1));

            CloneListTest(Helper.CreateItems(10));

            //LinkedListItemTest.Equal_Value_Tests();

            LinkedListHandlerTest.IsUnique_Test();
            LinkedListHandlerTest.Equal_Test();
            LinkedListHandlerTest.Length_Test();
            LinkedListHandlerTest.GetLastItem_Test();
            LinkedListHandlerTest.GetNthItem_Test();

            LinkedListHandlerTest.Clone_LoopBack_List_Tests();
        }
示例#2
0
        public void TestCollections()
        {
            var           serializer = CreateSerializer();
            ValueTypeTest _test      = new ValueTypeTest();

            _test.integer    = 1337;
            _test.identifier = "vtTest";
            ValueTypeTest _test2 = new ValueTypeTest();

            _test2.integer    = 123;
            _test2.identifier = "vtTest2";
            ValueTypeTestNoRoot _test3 = new ValueTypeTestNoRoot();

            _test3.integer = 1337;

            CollectionTest test = new CollectionTest();

            test.test  = new ValueTypeTestNoRoot[] { _test3 };
            test.test2 = new ValueTypeTest[] { _test2, _test }.ToList();
            test.test3 = new List <int>();
            test.test3.Add(321);
            test.test3.Add(132);

            List <ISerializableRoot> roots = new List <ISerializableRoot>();

            roots.Add(test);
            roots.Add(_test2);
            roots.Add(_test);
            string xml = serializer.Serialize(roots, out errors);

            FlushErrors();
            Debug.Log(xml);

            roots.Clear();
            serializer.Deserialize(new string[] { xml }, new string[] { "MEMORY" }, null, out roots, out errors);
            FlushErrors();

            Assert.AreEqual(roots.Count, 3);
            Assert.AreEqual(test, roots[0]);
            Assert.AreEqual(1337, (roots[0] as CollectionTest).test2[1].integer);
            Assert.AreEqual(132, (roots[0] as CollectionTest).test3[1]);
        }
示例#3
0
        public void TestValueTypes()
        {
            var           serializer = CreateSerializer();
            ValueTypeTest test       = new ValueTypeTest();

            test.integer = 1337;

            List <ISerializableRoot> roots = new List <ISerializableRoot>();

            roots.Add(test);
            string xml = serializer.Serialize(roots, out errors);

            FlushErrors();
            Debug.Log(xml);

            roots.Clear();
            serializer.Deserialize(new string[] { xml }, new string[] { "MEMORY" }, null, out roots, out errors);
            FlushErrors();

            Assert.AreEqual(roots.Count, 1);
            Assert.AreEqual(test, roots[0]);
        }
示例#4
0
    static void Main()
    {
        /*Console.WriteLine("Please enter your First name :");
        *  string FirstName = Console.ReadLine();
        *
        *  Console.WriteLine("Pease enter your Last name");
        *  string LastName = Console.ReadLine();
        *
        *  //Console.WriteLine("Hello" + UserName);
        *  //Console.WriteLine("Hello{0}", UserName);
        *  Console.WriteLine($"Hello,{FirstName},{LastName}"); */

        /* int i = 0;
         * Console.WriteLine($"Max :{ int.MaxValue}");
         * Console.WriteLine($"Min :{int.MinValue}");  */

        // float fl = 4.5f;
        // Console.WriteLine(fl);
        // double d = 3.2444;
        // Console.WriteLine(d);

        /* //String types
         *
         * string str = "\"Prasanna \n Satya \n Abhi \n Shreya\"";
         * Console.WriteLine(str);
         * string str1 = "C:\\programs\\downloads\\indu";
         * Console.WriteLine(str1);
         * string str2 = @"C:\programs\downloads\indu";
         * Console.WriteLine(str2);
         */

        /* // operators
         *
         * int n = 10;
         * int d = 2;
         * int q = n / d;
         * Console.WriteLine($"Quotient : {q}");
         *
         * int r = n % d;
         * Console.WriteLine($"Remainder : {r}");
         *
         * int a1 = 10;
         * int a2 = 22;
         *
         * if (a1 ==10 && a2==20)
         * {
         *   Console.WriteLine("Hello");
         * }
         *
         * int a3 = 20;
         * int a4 = 10;
         *
         * if (a3 == 20 || a4 == 30)
         * {
         *   Console.WriteLine("Hi");
         * }
         */

        /* // Ternary operator
         *
         * int a5 = 10;
         * bool a6;
         *
         * if (a5 == 10)
         * {
         *   a6 = true;
         * }
         * else
         * {
         *   a6 = false;
         * }
         *
         * Console.WriteLine(a6);
         *
         * bool a7 = a5 == 10 ? true : false;
         *
         * Console.WriteLine(a7);
         */

        // Nullable types
        // NullableTest.Test();
        // Nullcoalescingtest.Test();
        // TypeConversionTest.Test();
        //  ArraysTest.Test();
        // ConditionsTest.Test();
        //SwithStatementTest.Test();
        //CoffeshopTest.Test();
        // WhileLoopTest.Test();
        // DoWhileTest.Test();
        //CoffeeShopwithDowhileLoop.Test();
        //ForLoopTest.Test();
        //BreakAndContinueTest.Test();

        /* MethodTest t = new MethodTest();
         * MethodTest.EvenNumbers(20);
         * int Total = t.Add(10, 20);
         * Console.WriteLine(Total);*/

        ValueTypeTest V = new ValueTypeTest();
    }