Esempio n. 1
0
        public void AssertEqualsTo(TargetStruct target)
        {
            Assert.AreEqual(Int16Field, target.Int16Field);
            Assert.AreEqual(Int32Field, target.Int32Field);
            Assert.AreEqual(Int64Field, target.Int64Field);
            Assert.AreEqual(UInt16Field, target.UInt16Field);
            Assert.AreEqual(UInt32Field, target.UInt32Field);
            Assert.AreEqual(UInt64Field, target.UInt64Field);
            Assert.AreEqual(DoubleField, target.DoubleField);
            Assert.AreEqual(SingleField, target.SingleField);
            Assert.AreEqual(ByteField, target.ByteField);
            Assert.AreEqual(SByteField, target.SByteField);
            Assert.AreEqual(StringField, target.StringField);
            Assert.AreEqual(GuidField, target.GuidField);

            Assert.AreEqual(Int16Property, target.Int16Property);
            Assert.AreEqual(Int32Property, target.Int32Property);
            Assert.AreEqual(Int64Property, target.Int64Property);
            Assert.AreEqual(UInt16Property, target.UInt16Property);
            Assert.AreEqual(UInt32Property, target.UInt32Property);
            Assert.AreEqual(UInt64Property, target.UInt64Property);
            Assert.AreEqual(DoubleProperty, target.DoubleProperty);
            Assert.AreEqual(SingleProperty, target.SingleProperty);
            Assert.AreEqual(ByteProperty, target.ByteProperty);
            Assert.AreEqual(SByteProperty, target.SByteProperty);
            Assert.AreEqual(StringProperty, target.StringProperty);
            Assert.AreEqual(GuidProperty, target.GuidProperty);

            Assert.IsTrue(Utils.ValuesEquals(Int32ArrayField, target.Int32ArrayField));
            Assert.IsTrue(Utils.ValuesEquals(Int32ListField, target.Int32ListField));
            Assert.IsTrue(Utils.ValuesEquals(Int32ArrayProperty, target.Int32ArrayProperty));
            Assert.IsTrue(Utils.ValuesEquals(Int32ListProperty, target.Int32ListProperty));

            if (TargetClassField == null)
            {
                Assert.IsNull(target.TargetClassField);
            }
            else
            {
                TargetClassField.AssertEqualsTo(target.TargetClassField);
            }

            if (TargetClassProperty == null)
            {
                Assert.IsNull(target.TargetClassProperty);
            }
            else
            {
                TargetClassProperty.AssertEqualsTo(target.TargetClassProperty);
            }
        }
Esempio n. 2
0
        public void FillValues(int depth)
        {
            depth++;

            Int16Field  = Int16.MaxValue;
            Int32Field  = Int32.MaxValue;
            Int64Field  = Int64.MaxValue;
            UInt16Field = UInt16.MaxValue;
            UInt32Field = UInt32.MaxValue;
            UInt64Field = UInt64.MaxValue;
            DoubleField = Double.MaxValue;
            SingleField = Single.MaxValue;
            StringField = "String_Строка_行";
            ByteField   = Byte.MaxValue;
            SByteField  = SByte.MaxValue;
            GuidField   = new Guid(new byte[] { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 });

            Int16Property  = Int16.MinValue;
            Int32Property  = Int32.MinValue;
            Int64Property  = Int64.MinValue;
            UInt16Property = UInt16.MinValue;
            UInt32Property = UInt32.MinValue;
            UInt64Property = UInt64.MinValue;
            DoubleProperty = Double.MinValue;
            SingleProperty = Single.MinValue;
            StringProperty = "行_Строка_String";
            ByteProperty   = Byte.MinValue;
            SByteProperty  = SByte.MinValue;
            GuidProperty   = new Guid(new byte[] { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 });

            Int32ArrayField = new int[5] {
                1, 2, 3, 4, 5
            };
            Int32ListField = new List <int>()
            {
                6, 7, 8, 9, 10
            };
            Int32ArrayProperty = new int[5] {
                10, 20, 30, 40, 50
            };
            Int32ListProperty = new List <int>()
            {
                60, 70, 80, 90, 100
            };
            ArrayWithClassInheritedFromAbstractProperty = new TargetAbstractClass[1] {
                new TargetClassInheritedFromAbstract(132541)
            };
            ListWithClassInheritedFromAbstractProperty = new List <TargetAbstractClass>()
            {
                new TargetClassInheritedFromAbstract(1111)
            };
            TargetAbstractClassProperty = new TargetClassInheritedFromAbstract(2222);
            ArrayOfObjectsProperty      = new object[1] {
                new TargetClassInheritedFromAbstract(1515241)
            };

            Int32Int32DictionaryField = new Dictionary <int, int>();
            Int32Int32DictionaryField.Add(0, 1);
            Int32Int32DictionaryField.Add(1, 2);
            Int32Int32DictionaryField.Add(2, 3);

            Int32Int32DictionaryProperty = new Dictionary <int, int>();
            Int32Int32DictionaryProperty.Add(0, 1);
            Int32Int32DictionaryProperty.Add(1, 2);
            Int32Int32DictionaryProperty.Add(2, 3);

            if (depth < 3)
            {
                SubTargetClassField = new TargetClass();
                SubTargetClassField.FillValues(depth);

                SubTargetStructProperty = new TargetStruct();
                SubTargetStructProperty.FillValues(depth);
            }

            if (depth < 5)
            {
                SubTargetClassProperty = new TargetClass();
                SubTargetClassProperty.FillValues(depth);

                SubTargetStructField = new TargetStruct();
                SubTargetStructField.FillValues(depth);
            }
        }