System.Data.Tests.DataRelationTest.Creation4 C# (CSharp) Метод

Creation4() приватный Метод

private Creation4 ( ) : void
Результат void
        public void Creation4()
        {
            DataRelation Relation = new DataRelation("Rel", "Mom", "Child",
                                                      new string[] { "ChildName" },
                                                      new string[] { "Name" }, true);

            Assert.Throws<NullReferenceException>(() => _set.Relations.Add(Relation));
            Assert.Throws<NullReferenceException>(() => _set.Relations.AddRange(new DataRelation[] { Relation }));

            _set.BeginInit();
            _set.Relations.AddRange(new DataRelation[] { Relation });
            _set.EndInit();

            DataRelation Test = null;
            Assert.Equal(1, _mom.ChildRelations.Count);
            Assert.Equal(0, _child.ChildRelations.Count);
            Assert.Equal(0, _mom.ParentRelations.Count);
            Assert.Equal(1, _child.ParentRelations.Count);

            Test = _child.ParentRelations[0];
            Assert.Equal("Rel", Test.ToString());
            Assert.Equal("Rel", Test.RelationName);
            Assert.Equal("Mom", Test.ParentTable.TableName);

            Assert.Null(Test.ParentKeyConstraint);

            Assert.Equal(1, Test.ParentColumns.Length);
            Assert.True(Test.Nested);
            Assert.Equal(0, Test.ExtendedProperties.Count);
            Assert.Equal("Child", Test.ChildTable.TableName);
            Assert.Null(Test.ChildKeyConstraint);
            Assert.Equal(1, Test.ChildColumns.Length);
        }