System.Data.Tests.DataSetInferXmlSchemaTest.ConflictExistingPrimaryKey C# (CSharp) Method

ConflictExistingPrimaryKey() private method

private ConflictExistingPrimaryKey ( ) : void
return void
        public void ConflictExistingPrimaryKey()
        {
            Assert.Throws<ConstraintException>(() =>
           {
               // <wrong>The 'col' DataTable tries to create another primary key (and fails)</wrong> The data violates key constraint.
               var ds = new DataSet();
               ds.Tables.Add(new DataTable("table"));
               DataColumn c = new DataColumn("pk");
               ds.Tables[0].Columns.Add(c);
               ds.Tables[0].PrimaryKey = new DataColumn[] { c };
               XmlTextReader xtr = new XmlTextReader(_xml22, XmlNodeType.Document, null);
               xtr.Read();
               ds.ReadXml(xtr, XmlReadMode.InferSchema);
           });
        }