示例#1
0
        public void VerifyRegion()
        {
            IRegion region = BusinessObjectInitializer.CreateRegion();
            Random  random = new Random();

            region.Name = DATestUtils.GenerateString(30, true, false);
            region.Code = DATestUtils.GenerateString(8, true, true);
            region.Rank = random.Next(100000, 200000);

            int newId = InsertRegionTest(region);

            Assert.Greater(newId, 0);

            int rowsUpdated = UpdateRegionTest(region);

            Assert.AreEqual(1, rowsUpdated);

            DataTable resultTable = SelectRegionTest(region).Tables[0];

            //Verifies that the table contains the correct column names and order
            StringCollection columns = new StringCollection();

            columns.AddRange(new string[] { "Code",
                                            "Name",
                                            "Rank",
                                            "Id" });

            DATestUtils.CheckTableStructure(resultTable, columns);

            int rowCount = DeleteRegionTest(region);

            Assert.AreEqual(1, rowCount);
        }