Пример #1
0
        private static TestUdo CreateTestUdo()
        {
            // master
            var instance = new TestUdo
            {
                AlphaNumericalField = @"Alpha",
                IntegerField        = 1234,
                DoubleField         = 12.34,
                DateTimeField       = new DateTime(2001, 1, 1),
                MemoField           = @"Memo"
            };

            // detail
            var collection = new TestUdoChild
            {
                ChildAlphaNumericalField = @"Alpha",
                ChildIntegerField        = 1234,
                ChildDoubleField         = 12.34,
                ChildDateTimeField       = new DateTime(2001, 1, 1),
                ChildMemoField           = @"Memo"
            };

            instance.CollectionField.Add(collection);
            return(instance);
        }
Пример #2
0
        private void AssertMatch(TestUdo expected, TestUdo actual)
        {
            Assert.AreEqual(expected.AlphaNumericalField, actual.AlphaNumericalField);
            Assert.AreEqual(expected.IntegerField, actual.IntegerField);
            Assert.AreEqual(expected.DoubleField, actual.DoubleField);
            Assert.AreEqual(expected.DateTimeField, actual.DateTimeField);
            Assert.AreEqual(expected.MemoField, actual.MemoField);

            for (int i = 0; i < expected.CollectionField.Count; i++)
            {
                var value = expected.CollectionField.ElementAt(i);
                var other = actual.CollectionField.ElementAt(i);

                Assert.AreEqual(value.ChildAlphaNumericalField, other.ChildAlphaNumericalField);
                Assert.AreEqual(value.ChildIntegerField, other.ChildIntegerField);
                Assert.AreEqual(value.ChildDoubleField, other.ChildDoubleField);
                Assert.AreEqual(value.ChildDateTimeField, other.ChildDateTimeField);
                Assert.AreEqual(value.ChildMemoField, other.ChildMemoField);
            }
        }