예제 #1
0
        public void OnCheckpointReached(object source, CheckpointEventArgs args)
        {
            this.checkpointCoords = args.Coordinates;
            Checkpoint obj = (Checkpoint)source;

            obj.CheckpointReached -= OnCheckpointReached;
        }
예제 #2
0
 /// <summary>
 /// This reusable method is used to check if expected and actual object is not null else perform string comparison
 /// </summary>
 public void AssertIfNotNull(CheckpointEventArgs cehckArgs, object expectedObj, object actualObj, string sDescription)
 {
     if (expectedObj != null && actualObj != null)
     {
         //verify if values match
         cehckArgs.Checkpoint.Assert.Equals("", expectedObj.ToString(), actualObj.ToString(), sDescription);
     }
 }
예제 #3
0
        /// <summary>
        /// Handler for the RESTActivityV24 Activity’s CodeCheckPointEvent event.
        /// </summary>

        public void RESTActivityV24_OnCodeCheckPointEvent(object sender, CheckpointEventArgs args)
        {
            //checking of 200 pass/fail transaction
            if (this.RESTActivityV24.StatusCode == 200)
            {
                this.RESTActivityV24.Output.Transaction_Status = "PASS";
            }
            else
            {
                this.RESTActivityV24.Output.Transaction_Status = "FAIL";
            }
        }
예제 #4
0
        /// <summary>
        /// Handler for the CodeActivity21 Activity’s ExecuteEvent event.
        /// </summary>
        /// <param name=\"sender\">The activity object that raised the ExecuteEvent event.</param>
        /// <param name=\"args\">The event arguments passed to the activity.</param>
        /// Use this.CodeActivity21 to access the CodeActivity21 Activity's context, including input and output properties.
        public void CodeActivity21_OnExecuteEvent(object sender, STActivityBaseEventArgs args)
        {
            //Initialize checkArgsPoint object
            checkArgs = new CheckpointEventArgs(this.CodeActivity21);
            //open Database connection
            OpenDBConnection(this.CodeActivity21.Input.connectionString);

            //Get the record from the database
            datarowsMaster = GetRecords.GetRecordsFromDatabase(connection, command, dataAdapter, jenkinsHandle(this.SwitchEnvironment27.pEnvironment, this.CodeActivity21.Input.sqlQueryMaster, jenkinsDataSource));

            //check record count
            CheckDataRowsCount(datarowsMaster.Count, this.CodeActivity21);

            // Get the Master customer Id
            this.CodeActivity21.Output.Mstr_Cust_Id = datarowsMaster[0].ItemArray[0].ToString();

            //Replace placeholders in request body
            string requestBody = this.CodeActivity21.Input.requestBody.Replace("Master_Cust_Id_value", this.CodeActivity21.Output.Mstr_Cust_Id).ToString();

            if (this.CodeActivity21.Input.caseType.ToUpper() == "MASTERANDBRANCH")
            {
                datarowsBranch = GetRecords.GetRecordsFromDatabase(connection, command, dataAdapter, jenkinsHandle(this.SwitchEnvironment27.pEnvironment,
                                                                                                                   this.CodeActivity21.Input.sqlQueryBranch.Replace("mstr_cust_id_value", datarowsMaster[0].ItemArray[0].ToString()), jenkinsDataSource));

                CheckDataRowsCount(datarowsBranch.Count, this.CodeActivity21);

                //Replace placeholders in request body
                requestBody = requestBody.Replace("Branch_Cust_Id_value", datarowsBranch[0].ItemArray[0].ToString().Split('*')[1]).
                              Replace("Branch_Cust_Acct", datarowsBranch[0].ItemArray[0].ToString().Split('*')[0]);
            }

            this.CodeActivity21.Output.requestBodyOut = requestBody;

            //Close database connection
            CloseDBConnection();
        }
예제 #5
0
        /// <summary>
        /// Handler for the RESTActivityV220 Activity’s CodeCheckPointEvent event.
        /// </summary>
        /// <param name=\"sender\">The activity object that raised the CodeCheckPointEvent event.</param>
        /// <param name=\"args\">The event arguments passed to the activity.</param>
        /// Use this.RESTActivityV220 to access the RESTActivityV220 Activity's context, including input and output properties.
        public void RESTActivityV220_OnCodeCheckPointEvent(object sender, CheckpointEventArgs args)
        {
            if (this.SwitchEnvironment27.IsLoadTestEnabled != "true")
            {
                // checkArgsPoint
                checkArgs = new CheckpointEventArgs(this.RESTActivityV220);
                //Open database connection
                OpenDBConnection(this.CodeActivity21.Input.connectionString);

                //Get all branch customers related to the given master customer id
                salesOrderList = GetListOfAllSalesOrders(this.CodeActivity21.Input.ValidationQuery.Replace("MSTR_CUST_ID_VALUE", this.CodeActivity21.Output.Mstr_Cust_Id));

                //close database connection
                CloseDBConnection();
                // Fetch the JSON response
                XMLResponse = this.RESTActivityV220.ResponseBody;

                //Create deserialized XML objects
                DserialisedXMLResponse = XMLResponse.DeserializeFromXMLInput <SearchSalesOrdersResponse>();

                //Validating the total count of returned records
                VerificationAssert(DserialisedXMLResponse.TotalRecordsFound, salesOrderList.Count, "Checking of total record found");

                int recordCountCheck = 0;

                foreach (SalesOrder SalesOrderElement  in DserialisedXMLResponse.SalesOrder)
                {
                    foreach (SalesOrderDTO record in salesOrderList)
                    {
                        if (SalesOrderElement.OrderId == record.sale_Id && SalesOrderElement.OrderAcctId == record.sale_Acct)
                        {
                            // checkArgs the respective fields for verification
                            VerificationAssert(SalesOrderElement.OrderId, record.sale_Id, "Order ID");
                            VerificationAssert(SalesOrderElement.OrderAcctId, record.sale_Acct, "Order Account ID");
                            VerificationAssert(SalesOrderElement.CustAcctId + "*" + SalesOrderElement.CustId, record.Cust_Key, "Cust Key");
                            VerificationAssert(Convert.ToDateTime(SalesOrderElement.OrderDate).ToString("dd/MM/yyyy"), Convert.ToDateTime(record.order_Date).ToString("dd/MM/yyyy"), "Order Date");
                            VerificationAssert(SalesOrderElement.JobName, record.job_Name, "Job Name");
                            if (record.total_amount != "")
                            {
                                VerificationAssert(Convert.ToDecimal(SalesOrderElement.TotalAmt).ToString("0.00"), Convert.ToDecimal(record.total_amount).ToString("0.00"), "Total amount");
                            }
                            VerificationAssert(SalesOrderElement.CustomerPO, record.custPoNum, " Customer PO number");
                            VerificationAssert(SalesOrderElement.SubmitSiteId, record.srcSysCode, "Submit Site Id");
                            VerificationAssert(SalesOrderElement.CreatedBy, record.created_By, "createdBy");
                            VerificationAssert(SalesOrderElement.CompanyName, record.Company_Name, "companyName");
                            VerificationAssert(SalesOrderElement.UserEmail, record.user_Email, "userEmail");

                            break;
                        }
                    }

                    if (recordCountCheck == 10)
                    {
                        break;
                    }

                    recordCountCheck++;
                }
            }
            else
            {
                this.RESTActivityV220.Output.TransactionStatus = this.RESTActivityV220.StatusCode == 200 ? "PASS" : "FAIL";
            }
        }
예제 #6
0
 /// <summary>
 /// Handler for the FileWriteActivity47 Activity’s CodeCheckPointEvent event.
 /// </summary>
 /// <param name=\"sender\">The activity object that raised the CodeCheckPointEvent event.</param>
 /// <param name=\"args\">The event arguments passed to the activity.</param>
 /// Use this.FileWriteActivity47 to access the FileWriteActivity47 Activity's context, including input and output properties.
 public void FileWriteActivity47_OnCodeCheckPointEvent(object sender, CheckpointEventArgs args)
 {
     //TODO: Add your code here...
 }
예제 #7
0
        /// <summary>
        /// Handler for the CodeActivity17 Activity’s ExecuteEvent event.
        /// </summary>
        /// <param name=\"sender\">The activity object that raised the ExecuteEvent event.</param>
        /// <param name=\"args\">The event arguments passed to the activity.</param>
        /// Use this.CodeActivity17 to access the CodeActivity17 Activity's context, including input and output properties.
        public void CodeActivity17_OnExecuteEvent(object sender, STActivityBaseEventArgs args)
        {
            if (SwitchEnvironment14.IsLoadTestEnabled != "true")
            {
                int docArrayElementCount = 0;
                checkArgs = new CheckpointEventArgs(this.CodeActivity17);

                //Get the response
                XMLString = this.RESTActivityV24.ResponseBody;

                //Create Deserialize object
                DeserializedXMLproductResponse = XMLString.DeserializeFromXMLInput <ProductResponse>();

                //Customize the SQL Query for count
                customisedCountSqlQuery = "Select count(*) from (" + this.CodeActivity7.Output.Out_SQLParameter + ")";

                //Customize the SQL Query
                customisedSqlQuery = this.CodeActivity7.Output.Out_SQLParameter;

                //opening the DB conenction
                OpenDBConnection(this.CodeActivity7.Input.DBConnectionString);

                //Get the record from the database
                record = GetRecord(customisedCountSqlQuery, customisedSqlQuery, this.CodeActivity17);

                //verify database records count
                checkArgs.Checkpoint.Assert.Equals("", DeserializedXMLproductResponse.RowsTotal.ToString(), record.RecordsCount.ToString(), "Records count");

                //Verify product data
                foreach (Product doc_ProductNote in DeserializedXMLproductResponse.Products.Product)
                {
                    //isRecordAvailable = false;
                    foreach (Product2DTO recordNote in record.Product)
                    {
                        //Compare product Primary key
                        if (doc_ProductNote.ProductId.ToString() == recordNote.productId)
                        {
                            string altCodes = sortString(recordNote.altCodes);

                            //Verify productId
                            AssertIfNotNull(checkArgs, doc_ProductNote.ProductId, recordNote.productId, "Product V2 productId: " + docArrayElementCount);
                            //Verify productDesc
                            AssertIfNotNull(checkArgs, doc_ProductNote.Description, recordNote.description, "Product V2 prodDesc: " + docArrayElementCount);
                            //Verify discGroupId
                            AssertIfNotNull(checkArgs, doc_ProductNote.DiscGroupId, recordNote.discGroupId, "Product V2 discGroupId: " + docArrayElementCount);
                            //Verify discGroupDesc
                            AssertIfNotNull(checkArgs, doc_ProductNote.DiscGroupDesc, recordNote.discGroupDesc, "Product V2 discGroupDesc: " + docArrayElementCount);
                            //Verify linbuyId
                            AssertIfNotNull(checkArgs, doc_ProductNote.LinebuyId, recordNote.linebuyId, "Product V2 linebuyId: " + docArrayElementCount);
                            //Verify linebuyDesc
                            AssertIfNotNull(checkArgs, doc_ProductNote.LinebuyDesc, recordNote.linebuyDesc, "Product V2 linebuyDesc: " + docArrayElementCount);
                            //Verify altCode1
                            AssertIfNotNull(checkArgs, doc_ProductNote.Alt1Code, recordNote.alt1Code, "Product V2 altCode1: " + docArrayElementCount);
                            //Verify altCodes
                            AssertIfNotNull(checkArgs, sortString(doc_ProductNote.AltCodes.Trim()), sortString(recordNote.altCodes), "Product V2 altCodes: " + docArrayElementCount);
                            //Verify altCodeType
                            AssertIfNotNull(checkArgs, sortString(doc_ProductNote.AltCodeType.Trim()), sortString(recordNote.altCodeType), "Product V2 altCodeType: " + docArrayElementCount);

                            break;
                        }
                    }
                    docArrayElementCount++;
                }

                //closing the DB connection
                CloseDBConnection();
            }
        }