Exemplo n.º 1
0
        internal void DeleteShareSkill()
        {
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPathManageListing, "ManageListings");

            //Get the Category, Title, Description and Action for Deletion
            string CategoryToDelete    = GlobalDefinitions.ExcelLib.ReadData(2, "Category");
            string TitleToDelete       = GlobalDefinitions.ExcelLib.ReadData(2, "Title");
            string DescriptionToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "Description");
            string Action = GlobalDefinitions.ExcelLib.ReadData(2, "Deleteaction");

            //Navigate to Manage Listing
            NavigateToManageListing();

            //Call SearchListings Method to get count for existing records with same category,title and description as we are going to Delete
            int MatchingRecordsBeforeDelete = SearchListings(CategoryToDelete, TitleToDelete, DescriptionToDelete);

            Console.WriteLine("MatchingRecordsBeforeDelete== {0}", MatchingRecordsBeforeDelete);
            if (MatchingRecordsBeforeDelete < 1)
            {
                ShareSkill shareSkill = new ShareSkill();
                shareSkill.AddShareSkill();
                MatchingRecordsBeforeDelete = SearchListings(CategoryToDelete, TitleToDelete, DescriptionToDelete);
            }

            //Navigate to Manage Listing
            NavigateToManageListing();

            //Calling DeleteRecord to delete Share Skill
            DeleteRecord(CategoryToDelete, TitleToDelete, DescriptionToDelete, Action);

            //Call SearchListings Method to get count for existing records with same category,title and description as we have Deleted
            int MatchingRecordsAfterDelete = SearchListings(CategoryToDelete, TitleToDelete, DescriptionToDelete);
            int ExpectedRecords            = MatchingRecordsBeforeDelete - 1;

            Console.WriteLine("MatchingRecordsBeforeDelete== {0}", MatchingRecordsBeforeDelete);
            Console.WriteLine("MatchingRecordsAfterDelete =={0}", MatchingRecordsAfterDelete);

            //checking if number of records with same category,title and description is 1 less than it has before
            try
            {
                if (ExpectedRecords == MatchingRecordsAfterDelete)
                {
                    Base.test.Log(LogStatus.Pass, "Test Passed, Deleted a Share Skill Successfully");
                    Base.test.Log(LogStatus.Pass, "Image-" + img);
                    Assert.IsTrue(true);
                }
                else
                {
                    Base.test.Log(LogStatus.Fail, "Test Failed, Deleted a Share Skill Successfully" + img);
                }
            }
            catch (Exception e)
            {
                Base.test.Log(LogStatus.Fail, "Test Failed, Deleted a Share Skill Successfully", e.Message);
            }
        }
        //Check if existing Share SKill is present
        internal void CheckExistingSkillPresent()
        {
            //Navigate to Manage Listings
            NavigateToManageListing();

            //Creating Share Skill Object
            ShareSkill shareSkill = new ShareSkill();

            Thread.Sleep(1000);

            if (TableRows.Count < 1)
            {
                //Add a Share Skill
                shareSkill.AddShareSkill();
            }
        }
        //Delete the Share skill
        internal void DeleteShareSkill()
        {
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPathManageListing, "ManageListings");

            //Get the Category, Title, Description and Action for Deletion
            string CategoryToDelete    = GlobalDefinitions.ExcelLib.ReadData(2, "Category");
            string TitleToDelete       = GlobalDefinitions.ExcelLib.ReadData(2, "Title");
            string DescriptionToDelete = GlobalDefinitions.ExcelLib.ReadData(2, "Description");
            string Action = GlobalDefinitions.ExcelLib.ReadData(2, "Deleteaction");

            //Navigate to Manage Listing
            NavigateToManageListing();

            //Call SearchListings Method to get count for existing records with same category,title and description as we are going to Delete
            int MatchingRecordsBeforeDelete = SearchListings(CategoryToDelete, TitleToDelete, DescriptionToDelete);

            //Console.WriteLine("MatchingRecordsBeforeDelete== {0}", MatchingRecordsBeforeDelete);
            if (MatchingRecordsBeforeDelete < 1)
            {
                ShareSkill shareSkill = new ShareSkill();
                shareSkill.AddShareSkill();
                MatchingRecordsBeforeDelete = 1;
                //MatchingRecordsBeforeDelete = SearchListings(CategoryToDelete, TitleToDelete, DescriptionToDelete);
            }

            //Navigate to Manage Listing
            NavigateToManageListing();

            //Calling DeleteRecord to delete Share Skill
            DeleteRecord(CategoryToDelete, TitleToDelete, DescriptionToDelete, Action);

            //Call SearchListings Method to get count for existing records with same category,title and description as we have Deleted
            int MatchingRecordsAfterDelete = SearchListings(CategoryToDelete, TitleToDelete, DescriptionToDelete);
            int ExpectedRecords            = MatchingRecordsBeforeDelete - 1;

            //checking if number of records with same category,title and description is 1 less than it has before
            GlobalDefinitions.ValidateBoolean(ExpectedRecords == MatchingRecordsAfterDelete, "Share Skill Deleted");
        }