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

ConstraintCollectionTest() публичный Метод

public ConstraintCollectionTest ( ) : Xunit
Результат Xunit
        public ConstraintCollectionTest()
        {
            //Setup DataTable
            _table = new DataTable("TestTable");
            _table.Columns.Add("Col1", typeof(int));
            _table.Columns.Add("Col2", typeof(int));
            _table.Columns.Add("Col3", typeof(int));

            _table2 = new DataTable("TestTable");
            _table2.Columns.Add("Col1", typeof(int));
            _table2.Columns.Add("Col2", typeof(int));

            //Use UniqueConstraint to test Constraint Base Class
            _constraint1 = new UniqueConstraint(_table.Columns[0], false);
            _constraint2 = new UniqueConstraint(_table.Columns[1], false);

            // not sure why this is needed since a new _table was just created
            // for us, but this Clear() keeps the tests from throwing
            // an exception when the Add() is called.
            _table.Constraints.Clear();
        }