Esempio n. 1
0
        public virtual void InheritList_Class()
        {
            var source = new Helper3 <Helper1>()
            {
                PropOne = RandGen.GenerateInt()
            };

            for (int i = 0; i < 1000; i++)
            {
                source.Add(new Helper1()
                {
                    PropOne = RandGen.GenerateInt()
                });
            }
            ;

            var target = GetClone(source, 1001);

            Assert.NotSame(source, target);
            Assert.Equal(target.Count, source.Count);
            Assert.Equal(target.PropOne, source.PropOne);

            for (int i = 0; i < target.Count; i++)
            {
                Assert.NotSame(target[i], source[i]);
                Assert.Equal(target[i].PropOne, source[i].PropOne);
            }
        }
Esempio n. 2
0
        public void InheritList_Struct()
        {
            var source = new Helper3 <HelperStruct1>()
            {
                new HelperStruct1()
                {
                    PropOne = RandGen.GenerateInt()
                }
            };

            source.PropOne = RandGen.GenerateInt();

            var target = GetClone(source, 1);

            Assert.NotSame(source, target);
            Assert.Equal(source.Count, target.Count);
            Assert.Equal(source[0], target[0]);
            Assert.Equal(source[0].PropOne, target[0].PropOne);
            Assert.Equal(source.PropOne, target.PropOne);
        }
Esempio n. 3
0
        public virtual void InheritList_Int()
        {
            var source = new Helper3 <int>();

            for (int i = 0; i < 1000; i++)
            {
                source.Add(RandGen.GenerateInt());
            }
            ;

            var target = GetClone(source, 1);

            Assert.NotSame(source, target);
            Assert.Equal(target.Count, source.Count);

            for (int i = 0; i < target.Count; i++)
            {
                Assert.Equal(target[i], source[i]);
            }
        }
Esempio n. 4
0
        public void Setup()
        {
            _null = null;

            _simpleClass = new Helper1()
            {
                PropOne   = RandGen.GenerateInt(),
                PropTwo   = RandGen.GenerateInt(),
                PropThree = RandGen.GenerateInt(),
            };

            _complexClass = new Helper2()
            {
                Helper = new Helper1()
                {
                    PropOne   = RandGen.GenerateInt(),
                    PropTwo   = RandGen.GenerateInt(),
                    PropThree = RandGen.GenerateInt(),
                    PropFour  = RandGen.GenerateInt(),
                    PropFive  = RandGen.GenerateInt(),
                    PropSix   = RandGen.GenerateInt(),
                    PropSeven = RandGen.GenerateInt(),
                    PropEight = RandGen.GenerateInt(),
                    PropNine  = RandGen.GenerateInt(),
                    PropTen   = RandGen.GenerateInt()
                }
            };

            _inheritListClass = new Helper3 <Helper1>()
            {
                PropOne = RandGen.GenerateInt()
            };

            for (int i = 0; i < 10000; i++)
            {
                _inheritListClass.Add(new Helper1()
                {
                    PropOne = RandGen.GenerateInt()
                });
            }
            ;

            _inheritListInt = new Helper3 <int>();

            for (int i = 0; i < 10000; i++)
            {
                _inheritListInt.Add(RandGen.GenerateInt());
            }
            ;

            _grandChildClass = GrandChildClassHelper.Generate();

            _listSimpleClasses = new List <Helper1>();

            for (int i = 0; i < 10000; i++)
            {
                _listSimpleClasses.Add(new Helper1()
                {
                    PropOne   = RandGen.GenerateInt(),
                    PropTwo   = RandGen.GenerateInt(),
                    PropThree = RandGen.GenerateInt(),
                });
            }

            _listComplexClasses = new List <Helper2>();

            for (int i = 0; i < 10000; i++)
            {
                _listComplexClasses.Add(new Helper2()
                {
                    Helper = new Helper1()
                    {
                        PropOne   = RandGen.GenerateInt(),
                        PropTwo   = RandGen.GenerateInt(),
                        PropThree = RandGen.GenerateInt(),
                    }
                });
            }

            _listInterfaces = new List <MyTmpInterface>();

            for (int i = 0; i < 10000; i++)
            {
                _listInterfaces.Add(new Helper1());
                _listInterfaces.Add(new Helper1_1());
            }

            _listSimpleStructs = new List <HelperStruct1>();

            for (int i = 0; i < 10000; i++)
            {
                _listSimpleStructs.Add(new HelperStruct1()
                {
                    PropOne   = RandGen.GenerateInt(),
                    PropTwo   = RandGen.GenerateInt(),
                    PropThree = RandGen.GenerateInt(),
                });
            }

            _listComplexStructs = new List <HelperStruct2>();

            for (int i = 0; i < 10000; i++)
            {
                _listComplexStructs.Add(new HelperStruct2()
                {
                    Helper = new HelperStruct1()
                    {
                        PropOne   = RandGen.GenerateInt(),
                        PropTwo   = RandGen.GenerateInt(),
                        PropThree = RandGen.GenerateInt(),
                    }
                });
            }

            _dictOfStructs = new Dictionary <HelperStruct1, HelperStruct1>();

            for (int i = 0; i < 10000; i++)
            {
                _dictOfStructs.Add(
                    new HelperStruct1()
                {
                    PropOne   = RandGen.GenerateInt(),
                    PropTwo   = RandGen.GenerateInt(),
                    PropThree = RandGen.GenerateInt()
                },
                    new HelperStruct1()
                {
                    PropOne   = RandGen.GenerateInt(),
                    PropTwo   = RandGen.GenerateInt(),
                    PropThree = RandGen.GenerateInt()
                });
            }

            _dictOfClasses = new Dictionary <Helper1, Helper1>();

            for (int i = 0; i < 10000; i++)
            {
                _dictOfClasses.Add(
                    new Helper1()
                {
                    PropOne   = RandGen.GenerateInt(),
                    PropTwo   = RandGen.GenerateInt(),
                    PropThree = RandGen.GenerateInt()
                },
                    new Helper1()
                {
                    PropOne   = RandGen.GenerateInt(),
                    PropTwo   = RandGen.GenerateInt(),
                    PropThree = RandGen.GenerateInt()
                });
            }

            _dictOfInt = new Dictionary <int, int>();

            for (int i = 0; i < 10000; i++)
            {
                _dictOfInt.Add(i, RandGen.GenerateInt());
            }

            _listSimpleClassesAsInterfaces = _listSimpleClasses
                                             .OfType <MyTmpInterface>()
                                             .ToList();

            _listSimpleClassesAsObjects = _listSimpleClasses
                                          .Cast <object>()
                                          .ToList();
        }