Example #1
0
        public void SCR_203_035_StockpileForceOpeningStatus()
        {
            string stockpile = "";

            string testDataFile = this.testDataPath + @"SCR_203_035_StockpileForceOpeningStatus.xlsx";
            string sheetName    = "TestData";

            using (FileStream stream = File.Open(testDataFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                using (ExcelPackage package = new ExcelPackage(stream))
                {
                    // get the first worksheet in the workbook
                    ExcelWorksheet workSheet = package.Workbook.Worksheets[sheetName];

                    int rowNumber = 2;

                    Dashboard.GoTo();
                    StockpileConstraints.GoToStockpilesConstraints();

                    while (workSheet.Cells[rowNumber, 1].Value != null)
                    {
                        StockpileConstraintPage stockpileConstraint = new StockpileConstraintPage();

                        stockpile = workSheet.Cells[rowNumber, 1].Value.ToString();
                        if (stockpile == string.Empty)
                        {
                            break;
                        }

                        if (workSheet.Cells[rowNumber, 2].Value != null)
                        {
                            stockpileConstraint.reason = workSheet.Cells[rowNumber, 2].Value.ToString();
                        }

                        if (workSheet.Cells[rowNumber, 3].Value != null)
                        {
                            stockpileConstraint.forceOpeingStatus = workSheet.Cells[rowNumber, 3].Value.ToString();
                        }

                        StockpileConstraints.SCR_203_035_StockpileForceOpeningStatus(stockpile, stockpileConstraint);

                        StockpileConstraintPage stockpileConstraintPage = new StockpileConstraintPage();

                        StockpileConstraints.SCR_203_035_StockpileForceOpeningStatus_Checking(stockpile, stockpileConstraintPage);

                        Assert.AreEqual(stockpileConstraint.forceOpeingStatus, stockpileConstraintPage.forceOpeingStatus);
                        Assert.AreEqual(stockpileConstraint.reason, stockpileConstraintPage.reason);

                        rowNumber++;
                    }
                }
            }
        }
Example #2
0
        public void SCR_203_038_StockpileForceUnavailableForReclaiming()
        {
            string stockpile = "";

            string testDataFile = this.testDataPath + @"SCR_203_038_StockpileForceUnavailableForReclaiming.xlsx";
            string sheetName    = "TestData";

            using (FileStream stream = File.Open(testDataFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                using (ExcelPackage package = new ExcelPackage(stream))
                {
                    // get the first worksheet in the workbook
                    ExcelWorksheet workSheet = package.Workbook.Worksheets[sheetName];

                    int rowNumber = 2;

                    Dashboard.GoTo();
                    StockpileConstraints.GoToStockpilesConstraints();

                    while (workSheet.Cells[rowNumber, 1].Value != null)
                    {
                        StockpileConstraintPage stockpileConstraint = new StockpileConstraintPage();

                        stockpile = workSheet.Cells[rowNumber, 1].Value.ToString();
                        if (stockpile == string.Empty)
                        {
                            break;
                        }

                        if (workSheet.Cells[rowNumber, 2].Value != null)
                        {
                            stockpileConstraint.reason = workSheet.Cells[rowNumber, 2].Value.ToString();
                        }

                        if (workSheet.Cells[rowNumber, 3].Value != null)
                        {
                            stockpileConstraint.unavailableForReclaimingFromDatetime = workSheet.Cells[rowNumber, 3].Value.ToString();
                        }
                        else
                        {
                            //Add 7 hours
                            stockpileConstraint.unavailableForReclaimingFromDatetime = System.DateTime.Now.AddHours(7).ToLocalTime().ToString("dd/MM/yyyy HH:mm");
                        }

                        if (workSheet.Cells[rowNumber, 4].Value != null)
                        {
                            stockpileConstraint.unavailableForReclaimingToDatetime = workSheet.Cells[rowNumber, 4].Value.ToString();
                        }
                        else
                        {
                            //Add 8 hours
                            stockpileConstraint.unavailableForReclaimingToDatetime = System.DateTime.Now.AddHours(8).ToLocalTime().ToString("dd/MM/yyyy HH:mm");
                        }

                        StockpileConstraints.SCR_203_038_StockpileForceUnavailableForReclaiming(stockpile, stockpileConstraint);

                        StockpileConstraintPage stockpileConstraintPage = new StockpileConstraintPage();

                        StockpileConstraints.SCR_203_038_StockpileForceUnavailableForReclaiming_Checking(stockpile, stockpileConstraintPage);

                        Assert.AreEqual(stockpileConstraint.unavailableForReclaimingFromDatetime, stockpileConstraintPage.unavailableForReclaimingFromDatetime);
                        Assert.AreEqual(stockpileConstraint.unavailableForReclaimingToDatetime, stockpileConstraintPage.unavailableForReclaimingToDatetime);

                        Assert.AreEqual(stockpileConstraint.reason, stockpileConstraintPage.reason);

                        rowNumber++;
                    }
                }
            }
        }