System.Data.Tests.DataViewTest.DefaultColumnNameAddListChangedTest C# (CSharp) Method

DefaultColumnNameAddListChangedTest() private method

private DefaultColumnNameAddListChangedTest ( ) : void
return void
        public void DefaultColumnNameAddListChangedTest()
        {
            string result = @"setting table...
---- OnListChanged PropertyDescriptorChanged,0,0
---- OnListChanged Reset,-1,-1
table was set.
---- OnListChanged PropertyDescriptorAdded,0,0
 default named column added.
---- OnListChanged PropertyDescriptorAdded,0,0
 non-default named column added.
---- OnListChanged PropertyDescriptorAdded,0,0
 another default named column added (Column2).
---- OnListChanged PropertyDescriptorAdded,0,0
 add a column with the same name as the default columnnames.
---- OnListChanged PropertyDescriptorAdded,0,0
 add a column with a null name.
---- OnListChanged PropertyDescriptorAdded,0,0
 add a column with an empty name.
";
            _eventWriter = new StringWriter();
            DataTable dt = new DataTable("table");
            ComplexEventSequence1View dv =
                new ComplexEventSequence1View(dt, _eventWriter);
            dt.Columns.Add();
            _eventWriter.WriteLine(" default named column added.");
            dt.Columns.Add("non-defaultNamedColumn");
            _eventWriter.WriteLine(" non-default named column added.");
            DataColumn c = dt.Columns.Add();
            _eventWriter.WriteLine(" another default named column added ({0}).", c.ColumnName);
            dt.Columns.Add("Column3");
            _eventWriter.WriteLine(" add a column with the same name as the default columnnames.");
            dt.Columns.Add((string)null);
            _eventWriter.WriteLine(" add a column with a null name.");
            dt.Columns.Add("");
            _eventWriter.WriteLine(" add a column with an empty name.");

            Assert.Equal(result.Replace("\r\n", "\n"), _eventWriter.ToString().Replace("\r\n", "\n"));
            GC.KeepAlive(dv);
        }