public void VerifyCurrentProject()
        {
            Random random = new Random();

            DBGenericEntity dbCurrentProjectEntity = new DBCurrentProject(connManager);;
            ICurrentProject currentProject         = BusinessObjectInitializer.CreateCurrentProject();

            currentProject.IdAssociate = DATestUtils.DEFAULT_ASSOCIATE;
            currentProject.IdOwner     = DATestUtils.DEFAULT_ENTITY_ID;


            DataTable tableVerify = SelectCurrentProjectTest(currentProject, dbCurrentProjectEntity).Tables[0];

            //Verifies that the table is not null
            Assert.IsNotNull(tableVerify, "The table returned should not be null");
            //Verifies that the table returns the correcty columns
            DATestUtils.CheckColumn(tableVerify, 0, "ProjectId");
            DATestUtils.CheckColumn(tableVerify, 1, "ProjectName");
            DATestUtils.CheckColumn(tableVerify, 2, "ProgramName");
            DATestUtils.CheckColumn(tableVerify, 3, "ProjectFunction");
            DATestUtils.CheckColumn(tableVerify, 4, "ProgramId");
            DATestUtils.CheckColumn(tableVerify, 5, "ProjectFunctionId");
            DATestUtils.CheckColumn(tableVerify, 6, "OwnerId");
            DATestUtils.CheckColumn(tableVerify, 7, "ProgramCode");
            DATestUtils.CheckColumn(tableVerify, 8, "ProjectCode");
        }
Beispiel #2
0
        public void VerifyTimingAndInterco()
        {
            ITimingAndInterco  timingAndInterco   = BusinessObjectInitializer.CreateTimingAndInterco();
            DBTimingAndInterco dbTimingAndInterco = new DBTimingAndInterco(connManager);

            timingAndInterco.IdProject      = DATestUtils.DEFAULT_ENTITY_ID;
            timingAndInterco.IdPhase        = DATestUtils.DEFAULT_ENTITY_ID;
            timingAndInterco.IdWP           = DATestUtils.DEFAULT_ENTITY_ID;
            timingAndInterco.StartYearMonth = DATestUtils.DEFAULT_YEAR_MONTH;
            timingAndInterco.EndYearMonth   = DATestUtils.DEFAULT_YEAR_MONTH;

            DataSet datasetGetWPPeriod = GetAffectedWPTiming(timingAndInterco, dbTimingAndInterco);

            //Verifies that the dataset is not null
            Assert.IsNotNull(datasetGetWPPeriod, "The table returned should not be null");
            //Verifies that the dataset returns the correct columns
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[0], 0, "IdProject");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[0], 1, "IdPhase");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[0], 2, "PhaseCode");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[0], 3, "PhaseName");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[0], 4, "IdWP");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[0], 5, "WPCode");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[0], 6, "StartYearMonth");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[0], 7, "EndYearMonth");

            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 0, "IdProject");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 1, "IdPhase");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 2, "PhaseCode");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 3, "IdWP");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 4, "WPCode");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 5, "WPName");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 6, "StartYearMonth");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 7, "EndYearMonth");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 8, "LastUserUpdate");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 9, "LastUpdate");
            DATestUtils.CheckColumn(datasetGetWPPeriod.Tables[1], 10, "HasBudget");


            DataSet datasetGetWPIntercoCountries = GetAffectedWPInterco(timingAndInterco, dbTimingAndInterco);

            //Verifies that the dataset is not null
            Assert.IsNotNull(datasetGetWPIntercoCountries, "The table returned should not be null");
            //Verifies that the dataset returns the correct columns
            DATestUtils.CheckColumn(datasetGetWPIntercoCountries.Tables[1], 0, "IdProject");
            DATestUtils.CheckColumn(datasetGetWPIntercoCountries.Tables[1], 1, "IdPhase");
            DATestUtils.CheckColumn(datasetGetWPIntercoCountries.Tables[1], 2, "IdWP");
            DATestUtils.CheckColumn(datasetGetWPIntercoCountries.Tables[1], 3, "WPCode");
            DATestUtils.CheckColumn(datasetGetWPIntercoCountries.Tables[1], 4, "WPName");
            DATestUtils.CheckColumn(datasetGetWPIntercoCountries.Tables[1], 5, "PhaseCode");
            DATestUtils.CheckColumn(datasetGetWPIntercoCountries.Tables[1], 6, "HasBudget");
        }
        public void VerifyProjectFunction()
        {
            Random random = new Random();

            DBProjectFunction dbProjectFunctionEntity = new DBProjectFunction(connManager);
            IProjectFunction  projectFunction         = BusinessObjectInitializer.CreateProjectFunction();

            DataTable tableVerify = SelectProjectFunctionTest(projectFunction, dbProjectFunctionEntity).Tables[0];

            //Verifies that the table is not null
            Assert.IsNotNull(tableVerify, "The table returned should not be null");
            //Verifies that the table returns the correcty columns
            DATestUtils.CheckColumn(tableVerify, 0, "Id");
            DATestUtils.CheckColumn(tableVerify, 1, "Name");
        }
        public void VerifyProjectCoreTeamMember()
        {
            Random random = new Random();

            DBProjectCoreTeamMember dbProjectCoreTeamMemberEntity = new DBProjectCoreTeamMember(connManager);
            IProjectCoreTeamMember  projectCoreTeamMember         = BusinessObjectInitializer.CreateProjectCoreTeamMember();

            projectCoreTeamMember.IdFunction  = DATestUtils.DEFAULT_PROJECT_FUNCTION;
            projectCoreTeamMember.IdAssociate = DATestUtils.DEFAULT_ASSOCIATE;
            projectCoreTeamMember.IdProject   = random.Next(1, 2);
            projectCoreTeamMember.IsActive    = true;

            DataTable dtCoreTeamMembers = SelectProjectCoreTeamMemberTest(projectCoreTeamMember, dbProjectCoreTeamMemberEntity).Tables[0];

            if (dtCoreTeamMembers.Rows.Count == 0)
            {
                int newId = InsertProjectCoreTeamMemberTest(projectCoreTeamMember, dbProjectCoreTeamMemberEntity);
                Assert.AreEqual(newId, 1);
            }

            int rowsAffected = UpdateProjectCoreTeamMemberTest(projectCoreTeamMember, dbProjectCoreTeamMemberEntity);

            Assert.AreEqual(1, rowsAffected);

            int rowCount = DeleteProjectCoreTeamMemberTest(projectCoreTeamMember, dbProjectCoreTeamMemberEntity);

            Assert.AreEqual(1, rowCount);

            DataTable tableVerify = SelectProjectCoreTeamMemberTest(projectCoreTeamMember, dbProjectCoreTeamMemberEntity).Tables[0];

            //Verifies that the table is not null
            Assert.IsNotNull(tableVerify, "The table returned should not be null");
            //Verifies that the table returns the correcty columns
            DATestUtils.CheckColumn(tableVerify, 0, "CoreTeamMemberName");
            DATestUtils.CheckColumn(tableVerify, 1, "FunctionName");
            DATestUtils.CheckColumn(tableVerify, 2, "Country");
            DATestUtils.CheckColumn(tableVerify, 3, "LastUpdateDate");
            DATestUtils.CheckColumn(tableVerify, 4, "IsActive");
            DATestUtils.CheckColumn(tableVerify, 5, "IdProject");
            DATestUtils.CheckColumn(tableVerify, 6, "IdAssociate");
            DATestUtils.CheckColumn(tableVerify, 7, "IdFunction");
            DATestUtils.CheckColumn(tableVerify, 8, "ProjectName");
        }
Beispiel #5
0
        public void VerifyCurrentUser()
        {
            DBCurrentUser dbCurrentUserEntity = new DBCurrentUser(connManager);

            DataTable tableVerifyDetail = dbCurrentUserEntity.GetUserDetails(DATestUtils.DEFAULT_USER, ApplicationConstants.INT_NULL_VALUE);

            //Verifies that the table is not null
            Assert.IsNotNull(tableVerifyDetail, "The table returned should not be null");
            //Verifies that the table returns the correct columns
            DATestUtils.CheckColumn(tableVerifyDetail, 0, "IdAssociate");
            DATestUtils.CheckColumn(tableVerifyDetail, 1, "AssociateName");
            DATestUtils.CheckColumn(tableVerifyDetail, 2, "IdCountry");
            DATestUtils.CheckColumn(tableVerifyDetail, 3, "CountryName");
            tableVerifyDetail.Dispose();

            DataSet setVerifyPermissions = dbCurrentUserEntity.GetUserPermissions((int)tableVerifyDetail.Rows[0][0], (int)tableVerifyDetail.Rows[0][2]);

            DATestUtils.CheckColumn(setVerifyPermissions.Tables[0], 0, "IdRole");
            DATestUtils.CheckColumn(setVerifyPermissions.Tables[0], 1, "RoleName");
            DATestUtils.CheckColumn(setVerifyPermissions.Tables[1], 0, "ModuleCode");
            DATestUtils.CheckColumn(setVerifyPermissions.Tables[1], 1, "IdOperation");
            DATestUtils.CheckColumn(setVerifyPermissions.Tables[1], 2, "IdPermission");
            setVerifyPermissions.Dispose();

            DataTable tableVerifyProjects = dbCurrentUserEntity.GetUserProjects((int)tableVerifyDetail.Rows[0][0]);

            DATestUtils.CheckColumn(tableVerifyProjects, 0, "IdProject");
            DATestUtils.CheckColumn(tableVerifyProjects, 1, "ProjectName");
            DATestUtils.CheckColumn(tableVerifyProjects, 2, "IdFunction");
            DATestUtils.CheckColumn(tableVerifyProjects, 3, "ProjectFunction");
            tableVerifyProjects.Dispose();

            DataTable tableVerifyRolePermissions = dbCurrentUserEntity.GetRolePermissions((int)setVerifyPermissions.Tables[0].Rows[0][0]);

            DATestUtils.CheckColumn(tableVerifyRolePermissions, 0, "ModuleCode");
            DATestUtils.CheckColumn(tableVerifyRolePermissions, 1, "IdOperation");
            DATestUtils.CheckColumn(tableVerifyRolePermissions, 2, "IdPermission");
            tableVerifyRolePermissions.Dispose();
        }
        public void VerifyInitialBudget()
        {
            IInitialBudget         initialBudget   = BusinessObjectInitializer.CreateInitialBudget();
            ICostCenter            costCenter      = BusinessObjectInitializer.CreateCostCenter();
            IWorkPackage           workPackage     = BusinessObjectInitializer.CreateWorkPackage();
            IProject               project         = BusinessObjectInitializer.CreateProject();
            IProjectCoreTeamMember coreTeamMembers = BusinessObjectInitializer.CreateProjectCoreTeamMember();

            DBInitialBudget         dbInitialBudget     = new DBInitialBudget(connManager);
            DBGenericEntity         dbCostCenterEntity  = new DBCostCenter(connManager);
            DBGenericEntity         dbWorkPackageEntity = new DBWorkPackage(connManager);
            DBGenericEntity         dbProjectEntity     = new DBProject(connManager);
            DBProjectCoreTeamMember dbCoreteamMember    = new DBProjectCoreTeamMember(connManager);

            Random random = new Random();

            initialBudget.IdAssociate   = DATestUtils.DEFAULT_ASSOCIATE;
            initialBudget.IdPhase       = random.Next(1, 9);
            costCenter.Id               = random.Next(1000, 2000);
            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;

            workPackage.IdPhase          = initialBudget.IdPhase;
            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   = random.Next(2000, 2079) * 100 + random.Next(1, 12);
            workPackage.EndYearMonth     = random.Next(2000, 2079) * 100 + random.Next(1, 12);
            workPackage.LastUpdate       = DateTime.Today;
            workPackage.IdLastUserUpdate = DATestUtils.DEFAULT_ASSOCIATE;
            project.Name          = DATestUtils.GenerateString(50, true, false);
            project.Code          = DATestUtils.GenerateString(10, true, true);
            project.IdProgram     = random.Next(1, 2);
            project.IdProjectType = random.Next(1, 2);
            project.IsActive      = true;

            initialBudget.Sales       = random.Next(50000, 1000000);
            initialBudget.TotalHours  = random.Next(1, 100);
            initialBudget.ValuedHours = random.Next(1, 100);
            initialBudget.YearMonth   = DATestUtils.DEFAULT_YEAR_MONTH;

            int newId = InsertCostCenterTest(costCenter, dbCostCenterEntity);

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

            newId = InsertProjectTest(project, dbProjectEntity);
            //Verifies that the id returned by the insert method is greater than 0
            Assert.Greater(newId, 0);
            initialBudget.IdProject   = newId;
            workPackage.IdProject     = initialBudget.IdProject;
            coreTeamMembers.IdProject = initialBudget.IdProject;

            newId = InsertWorkPackageTest(workPackage, dbWorkPackageEntity);
            //Verifies that the id returned by the insert method is greater than 0
            Assert.Greater(newId, 0);
            initialBudget.IdWP = newId;

            InsertInitialBudgetMasterTest(initialBudget, dbInitialBudget);

            coreTeamMembers.IdAssociate = DATestUtils.DEFAULT_ASSOCIATE;
            coreTeamMembers.IdFunction  = DATestUtils.DEFAULT_PROJECT_FUNCTION;

            //verify if have core team member
            DataTable dsCoreMember = SelectProjectCoreTeamMemberTest(coreTeamMembers, dbCoreteamMember).Tables[0];

            if (dsCoreMember.Rows.Count == 0)
            {
                int IdCoreteammember = InsertProjectCoreTeamMemberTest(coreTeamMembers, dbCoreteamMember);
            }

            InsertInitialBudgetTest(initialBudget, dbInitialBudget);

            UpdateInitialBudgetTest(initialBudget, dbInitialBudget);

            DBWPPreselection tempTable = new DBWPPreselection(connManager);

            tempTable.BulkInsert("CREATE TABLE #BUDGET_PRESELECTION_TEMP (IdProject INT NOT NULL, IdPhase INT NOT NULL, IdWP INT NOT NULL)");
            tempTable.BulkInsert("INSERT  INTO #BUDGET_PRESELECTION_TEMP (IdProject,IdPhase,IdWP) VALUES (" + initialBudget.IdProject.ToString() + "," + initialBudget.IdPhase.ToString() + "," + initialBudget.IdWP.ToString() + ")");

            DataSet InitialBudgetDS = SelectInitialBudgetTest(initialBudget, dbInitialBudget);
            //Verifies that the table is not null
            DataTable tableVerifyPhases       = InitialBudgetDS.Tables[0];
            DataTable tableVerifyWorkPackages = InitialBudgetDS.Tables[1];
            DataTable tableVerifyCostCenters  = InitialBudgetDS.Tables[2];

            Assert.IsNotNull(tableVerifyPhases, "The table returned should not be null");
            Assert.IsNotNull(tableVerifyWorkPackages, "The table returned should not be null");
            Assert.IsNotNull(tableVerifyCostCenters, "The table returned should not be null");
            //Verifies that the first table is not null
            Assert.IsNotNull(tableVerifyPhases, "The table returned should not be null");
            //Verifies that the table returns the correcty columns
            DATestUtils.CheckColumn(tableVerifyPhases, 0, "IdProject");
            DATestUtils.CheckColumn(tableVerifyPhases, 1, "IdPhase");
            DATestUtils.CheckColumn(tableVerifyPhases, 2, "PhaseName");
            DATestUtils.CheckColumn(tableVerifyPhases, 3, "TotalHours");
            DATestUtils.CheckColumn(tableVerifyPhases, 4, "Averate");
            DATestUtils.CheckColumn(tableVerifyPhases, 5, "ValuedHours");
            DATestUtils.CheckColumn(tableVerifyPhases, 6, "OtherCosts");
            DATestUtils.CheckColumn(tableVerifyPhases, 7, "Sales");
            DATestUtils.CheckColumn(tableVerifyPhases, 8, "NetCosts");
            //Verifies that the second table is not null
            Assert.IsNotNull(tableVerifyWorkPackages, "The table returned should not be null");
            //Verifies that the table returns the correcty columns
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 0, "IdProject");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 1, "IdPhase");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 2, "IdWP");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 3, "WPName");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 4, "StartYearMonth");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 5, "EndYearMonth");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 6, "TotalHours");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 7, "Averate");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 8, "ValuedHours");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 9, "OtherCosts");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 10, "Sales");
            DATestUtils.CheckColumn(tableVerifyWorkPackages, 11, "NetCosts");
            //Verifies that the third table is not null
            Assert.IsNotNull(tableVerifyWorkPackages, "The table returned should not be null");
            //Verifies that the table returns the correcty columns
            DATestUtils.CheckColumn(tableVerifyCostCenters, 0, "IdProject");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 1, "IdPhase");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 2, "IdWP");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 3, "IdCostCenter");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 4, "CostCenterName");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 5, "TotalHours");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 6, "Averate");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 7, "ValuedHours");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 8, "OtherCosts");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 9, "Sales");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 10, "NetCosts");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 11, "IdCurrency");
            DATestUtils.CheckColumn(tableVerifyCostCenters, 12, "CurrencyCode");

            DeleteInitialBudgetTest(initialBudget, dbInitialBudget);

            int rowCount = DeleteCostCenterTest(costCenter, dbCostCenterEntity);

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

            rowCount = DeleteWorkPackageTest(workPackage, dbWorkPackageEntity);
            //Verifies that one and only one row is affected by the delete
            Assert.AreEqual(1, rowCount);

            //Verifies that one and only one row is affected by the delete
            rowCount = DeleteProjectCoreTeamMemberTest(coreTeamMembers, dbCoreteamMember);
            Assert.AreEqual(1, rowCount);

            rowCount = DeleteProjectTest(project, dbProjectEntity);
            //Verifies that one and only one row is affected by the delete
            Assert.AreEqual(1, rowCount);
        }