Beispiel #1
0
        /// <summary>
        /// Export Keys
        /// </summary>
        /// <param name="mainWindow"></param>
        public static void ExportKeys(MainWindow mainWindow, string WindowTitle, exportType type, bool isEncrypt)
        {
            mainWindow.Ribbon.ExportButton.Click();
            ExportKeyWizard exportWindow = new ExportKeyWizard(mainWindow.MainElement, WindowTitle);
            TextLog.LogMessage("Loaded Export Window " + mainWindow.Title);
            Thread.Sleep(1000);
            bool resultCell = false;
            bool resultPath = false;
            if (type == exportType.ExportCBR)
            {
                exportWindow.ExportCBR.Click();
            }
            else
            {
                exportWindow.ExportKeys.Click();
            }
            Thread.Sleep(1000);
            exportWindow.NextButton.Click();

            //Set value
            exportWindow.Tab.SelectItem(0);
            if (exportWindow.DataGridByQuantity.GridPattern.Current.RowCount > 0)
            {
                TextLog.LogMessage("There are [" + exportWindow.DataGridByQuantity.RowCount.ToString() + "] keys in the DataGridByQuantity.");
                string expectCBRNum = ReaderXML.testModule.Case[ReaderXML.CurrentCase].Input["Quantity"];
                exportWindow.DataGridByQuantity.SetValue(0, expectCBRNum);
                Thread.Sleep(1000);
                exportWindow.Tab.SelectItem(1);
                if (exportWindow.DataGridByID.GridPattern.Current.RowCount > 0)
                {
                    int CBRNum = Convert.ToInt32(expectCBRNum);
                    if (CBRNum > exportWindow.DataGridByID.RowCount)
                    {
                        CBRNum = exportWindow.DataGridByID.RowCount;
                        expectCBRNum = CBRNum.ToString();
                    }
                    for (int i = 1; i < CBRNum + 1; i++)
                    {
                        exportWindow.DataGridByID.CheckItem(i);
                    }

                    Thread.Sleep(1000);
                    TextLog.LogMessage("IsEncrypted the Export file.");
                    //Non-Encrypetd
                    bool IsChect = exportWindow.Encrypted.GetStatus() == "On" ? true : false;
                    if (!IsChect == isEncrypt)
                    {
                        exportWindow.Encrypted.Click();
                    }

                    string ExpectCell = exportWindow.DataGridByID.GetValue(0, 2);
                    string ExpectPath = exportWindow.Path.Text;
                    TextLog.LogMessage("Get Expect Value from DataGrid : [" + ExpectCell + "] \n " + ExpectPath);

                    exportWindow.OKButton.Click();
                    Thread.Sleep(1000);
                    if (!isEncrypt)
                    {
                        exportWindow.MessageboxWarning.ClickOK("1");
                        Thread.Sleep(1000);
                        exportWindow.OKButton.Click();
                    }
                    Thread.Sleep(500);
                    ProgressBarisFinish(exportWindow.ProgressBar, 3);
                    Thread.Sleep(500);
                    string ActualCell = exportWindow.DataGridSummary.GetValue(0, 1);
                    string ActualPath = exportWindow.TextBoxFileName.Text;
                    TextLog.LogMessage("Get Actual Value from DataGrid : [" + ActualCell + "] \n " + ActualPath);

                    ReaderXML.testModule.Case[ReaderXML.CurrentCase].Input["Path"] = ActualPath;
                    ReaderXML.testModule.Case[ReaderXML.CurrentCase].Input["Key"] = ActualCell;
                    resultCell = Helper.CompareTwoStr(ExpectCell, ActualCell);
                    resultPath = Helper.CompareTwoStr(ExpectPath, ActualPath);
                    Thread.Sleep(1000);
                    exportWindow.CloseButton.Click();
                }
                else
                {
                    TextLog.LogMessage("There not available key in the DataGridByID!");
                    Helper.CloseApp(exportWindow.MainElement);
                }

            }
            else
            {
                TextLog.LogMessage("There not available key in the DataGridByQuantity!");
                Helper.CloseApp(exportWindow.MainElement);
            }
            bool result = resultCell && resultPath == true ? true : false;
            Verification.AssertKMTResponse(result, ReaderXML.CurrentCase + "Test case ");
        }
Beispiel #2
0
 /// <summary>
 /// Export Encrpted Keys
 /// </summary>
 /// <param name="mainWindow"></param>
 public static void ExportEncryptedKeys(MainWindow mainWindow, string windowTitle, exportType type)
 {
     ExportKeys(mainWindow, windowTitle, type, true);
 }