示例#1
0
    int a, b; // private
    // Create a class factory for MyClass.
    public MyClass4 Factory(int i, int j)
    {
        MyClass4 t = new MyClass4();

        t.a = i;
        t.b = j;
        return(t); // return an object
    }
            public static int MainMethod(string[] args)
            {
                var  v1  = new MyClass3 <byte, dynamic, char>();
                bool ret = (123 == v1.P);
                var  v2  = new MyClass4 <dynamic, dynamic>();

                ret = (456 == v2.P);
                return(ret ? 0 : 1);
            }
            public static int MainMethod(string[] args)
            {
                var  v1  = new MyClass3 <MyClass1 <int>, byte, char>();
                bool ret = (123 == v1.P);
                var  v2  = new MyClass4 <int, uint>();

                ret = (456 == v2.P);
                return(ret ? 0 : 1);
            }
            public static int MainMethod(string[] args)
            {
                var  v   = new MyClass4 <string>();
                bool ret = (100 == v[99]);
                var  v2  = new MyClass3 <dynamic>();

                ret &= (-99 == v2[-100]);
                return(ret ? 0 : 1);
            }
示例#5
0
        public static void InsertSTUDENT()
        {
            ISqlMapper mapper = EntityMapper;
            MyClass4   testVo = new MyClass4()
            {
                NUMBER = "13-71019424", NAME = "OHYUNHO", AGE = "27", SEX = "MAN"
            };

            mapper.Insert("InsertSTUDENT", testVo);
        }
示例#6
0
        public static void SelectSTUDENT()
        {
            ISqlMapper       mapper     = EntityMapper;
            MyClass4         testVo     = new MyClass4();
            IList <MyClass4> resultList = mapper.QueryForList <MyClass4>("SelectSTUDENT", testVo);

            for (int x = 0; x < resultList.Count; x++)
            {
                Console.WriteLine(resultList[x].NUMBER + resultList[x].NAME + resultList[x].AGE + resultList[x].SEX);
            }
        }
示例#7
0
        public static void InsertSCORE()
        {
            ISqlMapper mapper = EntityMapper;
            MyClass4   testVo = new MyClass4()
            {
                NUMBER   = "13-71019424", KOREAN = "10", ENGLISH = "20", MATH = "30"
                , SOCIAL = "40", SCIENCE = "50"
            };

            mapper.Insert("InsertSCORE", testVo);
        }
示例#8
0
        public static void SelectSCORE()
        {
            ISqlMapper       mapper     = EntityMapper;
            MyClass4         testVo     = new MyClass4();
            IList <MyClass4> resultList = mapper.QueryForList <MyClass4>("SelectSCORE", testVo);

            for (int x = 0; x < resultList.Count; x++)
            {
                Console.WriteLine(resultList[x].NUMBER + resultList[x].KOREAN + resultList[x].ENGLISH + resultList[x].MATH
                                  + resultList[x].SOCIAL + resultList[x].SCIENCE);
            }
        }
示例#9
0
    public static bool CheckIsInstAnyIsInterfaceNo()
    {
        bool   res = false;
        Object obj = new MyClass4 <List <string> >();

        foreach (var iteration in Benchmark.Iterations)
        {
            using (iteration.StartMeasurement())
                res = obj is IMyInterface2;
        }
        return(res);
    }
示例#10
0
    static void Main()
    {
        MyClass4 ob = new MyClass4();
        int      i, j;

        // Generate objects using the factory.
        for (i = 0, j = 10; i < 10; i++, j--)
        {
            MyClass4 anotherOb = ob.Factory(i, j); // make an object
            anotherOb.Show();
        }
        Console.WriteLine();
    }
示例#11
0
        public void GivenAClassWithDataContractAndDataMember_WhenProperty2Ignored_ThenSerializedAllButNotIgnored()
        {
            // Arrange
            var x = new MyClass4()
            {
                MyProperty1 = 98765, MyProperty2 = "asdasdasd"
            };

            // Act
            var stringClass = ContractObjectToXml(x);

            // Assert
            Assert.IsTrue(stringClass.Contains("98765"));
            Assert.IsFalse(stringClass.Contains("asdasdasd"));
        }
示例#12
0
        public static bool CheckIsInstAnyIsInterfaceYes()
        {
            bool   res = false;
            Object obj = new MyClass4 <List <string> >();

            foreach (var iteration in Benchmark.Iterations)
            {
                using (iteration.StartMeasurement())
                    for (int i = 0; i < Benchmark.InnerIterationCount; i++)
                    {
                        res = obj is IMyInterface1;
                    }
            }
            return(res);
        }
示例#13
0
        public void SerializeInterfaceOnlyDataMemberWhenInterfaceDataContract()
        {
            IMyClass4 mc = new MyClass4 {
                MyProperty1 = 100, MyProperty2 = "foobar"
            };

            var bin = JsonSerializer.Serialize(mc);

            Encoding.UTF8.GetString(bin).Is(@"{""MyProperty1"":100}");

            var mc2 = JsonSerializer.Deserialize <MyClass4>(bin);

            mc.MyProperty1.Is(mc2.MyProperty1);
            mc.MyProperty2.IsNot(mc2.MyProperty2);
            mc2.MyProperty2.Is(null);
        }
示例#14
0
        static void Main(string[] args)
        {
            var c1 = new MyClass <string>();

            c1.Value = "a";
            c1.DefaultValue();

            var c2 = new MyClass <DateTime>();

            c2.Value = DateTime.Now;
            c2.DefaultValue();

            var c3 = new MyClass2 <object>();

            c3.DefaultValue();

            var c4 = new MyClass3 <Printable>();

            c4.Execute();

            var c5 = new MyClass4 <string, DateTime>();
        }
        public void Should_not_print_secrets()
        {
            var settings = new MyClass4
            {
                Class5 = new MyClass5
                {
                    Secret5 = "555"
                },
                Public4 = "p444",
                Secret4 = "s444"
            };

            var result = PrintAndParse(settings, false);

            result.Should()
            .Be(Normalize(
                    @"{
   ""Class5"": ""<secret>"",
   ""Public4"": ""p444"",
   ""Secret4"": ""<secret>""
}"));
        }
示例#16
0
        public void Utility_MemberwiseEquals_2()
        {
            object first = new MyClass4 {
                X = "X", Y = "Y"
            };
            object second = new MyClass4 {
                X = "X", Y = "Y"
            };

            Assert.IsTrue(Utility.MemberwiseEquals(first, second));
            Assert.IsTrue(Utility.MemberwiseEquals(second, first));
            Assert.IsTrue(Utility.MemberwiseEquals(first, first));
            Assert.IsTrue(Utility.MemberwiseEquals(second, second));

            second = new MyClass3 {
                X = 1, Y = 2
            };
            Assert.IsFalse(Utility.MemberwiseEquals(first, second));
            Assert.IsFalse(Utility.MemberwiseEquals(second, first));

            second = new MyClass4();
            Assert.IsFalse(Utility.MemberwiseEquals(first, second));
            Assert.IsFalse(Utility.MemberwiseEquals(second, first));
        }
示例#17
0
 public MyClass7(MyClass4 myClass4)
 {
     this.MyClass4 = myClass4;
 }
示例#18
0
 private static void MethodToCall(MyClass2 bar = null, MyClass1 qux = null, MyClass3 baz = null, MyClass4 waldo = null)
 {
 }