Beispiel #1
0
        public void VerifyOwner()
        {
            Random random = new Random();

            IOwner owner = BusinessObjectInitializer.CreateOwner();

            owner.Name        = DATestUtils.GenerateString(30, true, false);
            owner.Code        = DATestUtils.GenerateString(3, true, true);
            owner.IdOwnerType = random.Next(1, 5);
            owner.Rank        = random.Next(100000, 200000);

            int newId = InsertOwnerTest(owner);

            Assert.Greater(newId, 0);

            int rowsAffected = UpdateOwnerTest(owner);

            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectOwnerTest(owner).Tables[0];

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

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

            DATestUtils.CheckTableStructure(resultTable, columns);

            int rowCount = DeleteOwnerTest(owner);

            Assert.AreEqual(1, rowCount);
        }