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

            IProjectPhase projectPhase = BusinessObjectInitializer.CreateProjectPhase();

            projectPhase.Name = DATestUtils.GenerateString(50, true, false);
            projectPhase.Code = DATestUtils.GenerateString(10, true, true);

            int newId = InsertProjectPhaseTest(projectPhase);

            Assert.Greater(newId, 0);

            int rowsAffected = UpdateProjectPhaseTest(projectPhase);

            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectProjectPhaseTest(projectPhase).Tables[0];

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

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

            DATestUtils.CheckTableStructure(resultTable, columns);


            int rowCount = DeleteProjectPhaseTest(projectPhase);

            Assert.AreEqual(1, rowCount);
        }
Beispiel #2
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);
        }
        public void VerifyDepartment()
        {
            Random random = new Random();

            IDepartment department = BusinessObjectInitializer.CreateDepartment();

            department.Name       = DATestUtils.GenerateString(30, true, false);
            department.IdFunction = random.Next(1, 5);
            department.Rank       = random.Next(100000, 200000);

            int newId = InsertDepartmentTest(department);

            Assert.Greater(newId, 0);

            int rowsAffected = UpdateDepartmentTest(department);

            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectDepartmentTest(department).Tables[0];

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

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

            DATestUtils.CheckTableStructure(resultTable, columns);

            int rowCount = DeleteDepartmentTest(department);

            Assert.AreEqual(1, rowCount);
        }
        public void VerifyProjectType()
        {
            IProjectType projectType = BusinessObjectInitializer.CreateProjectType();

            Random random = new Random();

            projectType.Type = DATestUtils.GenerateString(20, true, false);
            projectType.Rank = random.Next(100000, 200000);

            int newId = InsertProjectTypeTest(projectType);

            Assert.Greater(newId, 0);

            int rowsAffected = UpdateProjectTypeTest(projectType);

            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectProjectTypeTest(projectType).Tables[0];

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

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

            DATestUtils.CheckTableStructure(resultTable, columns);

            int rowCount = DeleteProjectTypeTest(projectType);

            Assert.AreEqual(1, rowCount);
        }
        public void VerifyCountry()
        {
            ICountry country = BusinessObjectInitializer.CreateCountry();
            Random   random  = new Random();

            country.Code       = DATestUtils.GenerateString(3, true, true);
            country.Name       = DATestUtils.GenerateString(30, true, false);
            country.IdRegion   = random.Next(1, 3);
            country.IdCurrency = random.Next(1, 12);
            country.Rank       = random.Next(100000, 200000);

            int newId = InsertCountryTest(country);

            Assert.Greater(newId, 0);

            int rowsAffected = UpdateCountryTest(country);

            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectCountryTest(country).Tables[0];

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

            columns.AddRange(new string[] { "Code",
                                            "Name",
                                            "RegionName",
                                            "CurrencyName",
                                            "Email",
                                            "Rank",
                                            "Id",
                                            "IdRegion",
                                            "IdCurrency" });
            DATestUtils.CheckTableStructure(resultTable, columns);

            try
            {
                //we delete the 7 accounts associated with a country
                GlAccountTest accountTest = new GlAccountTest();
                accountTest.Initialize();
                IGlAccount glAccount = BusinessObjectInitializer.CreateGLAccount();

                glAccount.IdCountry = newId;
                for (int i = 1; i <= 7; i++)
                {
                    glAccount.Id = i;
                    accountTest.DeleteGlAccountTest(glAccount);
                }
                accountTest.CleanUp();
            }
            catch (Exception ex)
            {
                throw new Exception("Pre-Condition failed for delete operation. Gl/account operation meessage: " + ex.Message);
            }

            int rowCount = DeleteCountryTest(country);

            Assert.AreEqual(1, rowCount);
        }
        public void VerifyWorkPackage()
        {
            Random random = new Random();

            IWorkPackage workPackage = BusinessObjectInitializer.CreateWorkPackage();

            workPackage.IdProject        = random.Next(1, 2);
            workPackage.IdPhase          = random.Next(1, 9);
            workPackage.Code             = DATestUtils.GenerateString(3, true, true);
            workPackage.Name             = DATestUtils.GenerateString(30, true, false);
            workPackage.Rank             = random.Next(1, 100);
            workPackage.IsActive         = true;
            workPackage.StartYearMonth   = DATestUtils.DEFAULT_YEAR_MONTH;
            workPackage.EndYearMonth     = DATestUtils.DEFAULT_YEAR_MONTH;
            workPackage.LastUpdate       = DateTime.Today;
            workPackage.IdLastUserUpdate = DATestUtils.DEFAULT_ASSOCIATE;

            int newId = InsertWorkPackageTest(workPackage);

            Assert.Greater(newId, 0);

            int rowsAffected = UpdateWorkPackageTest(workPackage);

            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectWorkPackageTest(workPackage).Tables[0];

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

            columns.AddRange(new string[] { "ProjectPhase",
                                            "ProjectCode",
                                            "Code",
                                            "Name",
                                            "Rank",
                                            "IsActive",
                                            "StartYearMonth",
                                            "EndYearMonth",
                                            "LastUpdate",
                                            "LastUserUpdate",
                                            "IsProgramManager",
                                            "ProjectName",
                                            "IdLastUserUpdate",
                                            "Id",
                                            "IdPhase",
                                            "IdProject",
                                            "IdProjectFunction" });

            DATestUtils.CheckTableStructure(resultTable, columns);


            int rowCount = DeleteWorkPackageTest(workPackage);

            Assert.AreEqual(1, rowCount);
        }
Beispiel #7
0
        public void VerifyFunction()
        {
            Random random = new Random();

            IFunction function = BusinessObjectInitializer.CreateFunction();

            function.Name = DATestUtils.GenerateString(30, true, false);
            function.Id   = random.Next(1, 10);

            DataTable resultTable = SelectFunctionTest(function).Tables[0];

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

            columns.AddRange(new string[] { "Id",
                                            "Name" });
            DATestUtils.CheckTableStructure(resultTable, columns);
        }
Beispiel #8
0
        public void VerifyAssociate()
        {
            IAssociate associate = BusinessObjectInitializer.CreateAssociate();
            Random     random    = new Random();

            associate.IdCountry          = random.Next(1, 3);
            associate.Name               = DATestUtils.GenerateString(50, true, false);
            associate.InergyLogin        = DATestUtils.GenerateString(50, true, false);
            associate.EmployeeNumber     = DATestUtils.GenerateString(15, true, false);
            associate.IsActive           = true;
            associate.PercentageFullTime = random.Next(1, 100);
            associate.IsSubContractor    = true;

            int newId = InsertAssociateTest(associate);

            //Verifies that the id returned by the insert method is greater than 1
            Assert.Greater(newId, 0);

            int rowsAffected = UpdateAssociateTest(associate);

            //Verifies that one and only one row is affected by the update
            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectAssociateTest(associate).Tables[0];

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

            columns.AddRange(new string[] { "CountryName",
                                            "EmployeeNumber",
                                            "Name",
                                            "InergyLogin",
                                            "IsActive",
                                            "PercentageFullTime",
                                            "IsSubContractor",
                                            "Id",
                                            "IdCountry" });

            DATestUtils.CheckTableStructure(resultTable, columns);

            int rowCount = DeleteAssociateTest(associate);

            Assert.AreEqual(1, rowCount);
        }
Beispiel #9
0
        public void VerifyOwnerType()
        {
            Random random = new Random();

            IOwnerType      ownerType         = BusinessObjectInitializer.CreateOwnerType();
            DBGenericEntity dbOwnerTypeEntity = new DBOwnerType(connManager);

            ownerType.Name = DATestUtils.GenerateString(50, true, false);
            ownerType.Id   = random.Next(1, 5);

            DataTable resultTable = SelectOwnerTypeTest(ownerType).Tables[0];

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

            columns.AddRange(new string[] { "Id",
                                            "Name" });
            DATestUtils.CheckTableStructure(resultTable, columns);
        }
        public void VerifyCostIncomeType()
        {
            Random random = new Random();

            ICostIncomeType costIncomeType = BusinessObjectInitializer.CreateCostIncomeType();

            costIncomeType.Name = DATestUtils.GenerateString(30, true, false);
            costIncomeType.Id   = random.Next(1, 10);

            DataTable resultTable = SelectCostIncomeTypeTest(costIncomeType).Tables[0];

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

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

            DATestUtils.CheckTableStructure(resultTable, columns);
        }
Beispiel #11
0
        public void VerifyCurrency()
        {
            ICurrency currency = BusinessObjectInitializer.CreateCurrency();

            Random random = new Random();

            currency.Name = DATestUtils.GenerateString(30, true, false);
            //There are already currencies with id's from 1 to 12 in the database from the initialization script
            currency.Id = random.Next(1, 12);

            DataTable resultTable = SelectCurrencyTest(currency).Tables[0];

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

            columns.AddRange(new string[] { "Id",
                                            "Code",
                                            "Name" });
            DATestUtils.CheckTableStructure(resultTable, columns);
        }
        public void VerifyCostCenter()
        {
            Random random = new Random();

            ICostCenter costCenter = BusinessObjectInitializer.CreateCostCenter();

            costCenter.Name             = DATestUtils.GenerateString(50, true, false);
            costCenter.Code             = DATestUtils.GenerateString(10, true, true);
            costCenter.IdDepartment     = random.Next(1, 1);
            costCenter.IdInergyLocation = random.Next(1, 2);
            costCenter.IsActive         = true;

            int newId = InsertCostCenterTest(costCenter);

            Assert.Greater(newId, 0);

            int rowsAffected = UpdateCostCenterTest(costCenter);

            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectCostCenterTest(costCenter).Tables[0];

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

            columns.AddRange(new string[] { "InergyLocation",
                                            "Code",
                                            "Name",
                                            "IsActive",
                                            "DepartmentName",
                                            "FunctionName",
                                            "Id",
                                            "IdInergyLocation",
                                            "IdDepartment",
                                            "IdFunction" });
            DATestUtils.CheckTableStructure(resultTable, columns);

            int rowCount = DeleteCostCenterTest(costCenter);

            Assert.AreEqual(1, rowCount);
        }
Beispiel #13
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);
        }
        public void VerifyHourlyRate()
        {
            Random random = new Random();

            IHourlyRate hourlyRate = BusinessObjectInitializer.CreateHourlyRate();

            hourlyRate.YearMonth    = random.Next(2010, 2079) * 100 + random.Next(1, 12);
            hourlyRate.IdCurrency   = random.Next(1, 12);
            hourlyRate.IdCostCenter = random.Next(1, 3);
            hourlyRate.Value        = DATestUtils.DEFAULT_DECIMAL_VALUE;

            int newId = InsertHourlyRateTest(hourlyRate);

            Assert.AreEqual(newId, 0);

            int rowsAffected = UpdateHourlyRateTest(hourlyRate);

            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectHourlyRateTest(hourlyRate).Tables[0];

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

            columns.AddRange(new string[] { "InergyLocationName",
                                            "CostCenterCode",
                                            "CurrencyName",
                                            "Value",
                                            "YearMonth",
                                            "CostCenterName",
                                            "IdInergyLocation",
                                            "IdCostCenter",
                                            "IdCurrency" });

            DATestUtils.CheckTableStructure(resultTable, columns);

            int rowCount = DeleteHourlyRateTest(hourlyRate);

            Assert.AreEqual(1, rowCount);
        }
        public void VerifyGlAccount()
        {
            IGlAccount glAccount = BusinessObjectInitializer.CreateGLAccount();

            Random random = new Random();

            glAccount.Name       = DATestUtils.GenerateString(30, true, false);
            glAccount.Account    = DATestUtils.GenerateString(20, true, false);
            glAccount.IdCostType = random.Next(1, 6);
            glAccount.IdCountry  = random.Next(1, 3);

            int newId = InsertGlAccountTest(glAccount);

            Assert.Greater(newId, 0);

            int rowsAffected = UpdateGlAccountTest(glAccount);

            Assert.AreEqual(1, rowsAffected);

            DataTable resultTable = SelectGlAccountTest(glAccount).Tables[0];

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

            columns.AddRange(new string[] { "CountryName",
                                            "G/L Account",
                                            "Name",
                                            "CostType",
                                            "Id",
                                            "IdCountry",
                                            "IdCostType" });

            DATestUtils.CheckTableStructure(resultTable, columns);

            int rowCount = DeleteGlAccountTest(glAccount);

            Assert.AreEqual(1, rowCount);
        }