System.Data.Tests.DataViewTest2.ctor_ExpectedExceptions C# (CSharp) Method

ctor_ExpectedExceptions() private method

private ctor_ExpectedExceptions ( ) : void
return void
        public void ctor_ExpectedExceptions()
        {
            DataView dv = null;
            DataTable dt = new DataTable("myTable");

            // ctor - missing column CutomerID Exception
            Assert.Throws<EvaluateException>(() => // also IndexOutOfRangeException?
            {
                //exception: System.Data.EvaluateException: Cannot find column [CustomerId]
                dv = new DataView(dt, "CustomerId > 100", "Age", DataViewRowState.Added);
            });

            dt.Columns.Add(new DataColumn("CustomerId"));

            // ctor - missing column Age Exception
            Assert.Throws<IndexOutOfRangeException>(() =>
            {
                //exception: System.Data.EvaluateException: Cannot find column [Age]
                dv = new DataView(dt, "CustomerId > 100", "Age", DataViewRowState.Added);
            });
        }