Ejemplo n.º 1
0
        public void VerifyProgram()
        {
            Random random = new Random();

            IProgram program = BusinessObjectInitializer.CreateProgram();

            program.Name    = DATestUtils.GenerateString(50, true, false);
            program.Code    = DATestUtils.GenerateString(10, true, true);
            program.IdOwner = random.Next(1, 3);
            program.Rank    = random.Next(100000, 200000);

            int newId = InsertProgramTest(program);

            Assert.Greater(newId, 0);

            int rowsAffected = UpdateProgramTest(program);

            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectProgramTest(program).Tables[0];

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

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

            DATestUtils.CheckTableStructure(resultTable, columns);

            int rowCount = DeleteProgramTest(program);

            Assert.AreEqual(1, rowCount);
        }