コード例 #1
0
        //Failed, uploading work sample not working properly
        public void CreateService()
        {
            #region read data from ShareSkill sheet, row 2
            //Populate the excel data
            ExcelLib.PopulateInCollection(ExcelPath, "ShareSkill");

            //Read data
            string title            = ExcelLib.ReadData(2, "Title");
            string description      = ExcelLib.ReadData(2, "Description");
            string category         = ExcelLib.ReadData(2, "Category");
            string subCategory      = ExcelLib.ReadData(2, "SubCategory");
            string tags             = ExcelLib.ReadData(2, "Tags");
            string serviceType      = ExcelLib.ReadData(2, "ServiceType");
            string locationType     = ExcelLib.ReadData(2, "LocationType");
            string startDate        = ExcelLib.ReadData(2, "Startdate");
            string endDate          = ExcelLib.ReadData(2, "Enddate");
            string day              = ExcelLib.ReadData(2, "Selectday");
            string startTime        = ExcelLib.ReadData(2, "Starttime");
            string endTime          = ExcelLib.ReadData(2, "Endtime");
            string skillTradeOption = ExcelLib.ReadData(2, "SkillTrade");
            string skillExchangeTag = ExcelLib.ReadData(2, "Skill-exchange");
            string creditAmount     = ExcelLib.ReadData(2, "Credit");
            string active           = ExcelLib.ReadData(2, "Active");
            #endregion

            //Create a new service
            var shareSkillInstance = new ShareSkill();
            shareSkillInstance.ClickShareSkill();
            shareSkillInstance.EnterShareSkill(title, description, category, subCategory, tags, serviceType, locationType, startDate, endDate,
                                               day, startTime, endTime, skillTradeOption, skillExchangeTag, creditAmount, active);
            shareSkillInstance.ClickSave();

            //Verify if user get the message correctly
            string expectedMsg = "Service Listing Added successfully";
            string actualMsg   = Driver.FindElement(By.XPath("/html/body/div/div[@class='ns-box-inner']")).Text;
            Assert.That(actualMsg, Is.EqualTo(expectedMsg), "Getting expected message failed");

            //Verify if user been navigated to ListManagement Page
            string expectedTitle = "ListingManagement";
            string actualTitle   = Driver.Title;
            Assert.That(actualTitle, Is.EqualTo(expectedTitle), "Navigation to ListManagement Page failed");

            //Verify if the created service is listed in ListManagement Page successfully
            var manageListingsInstance = new ManageListings();
            Assert.That(manageListingsInstance.ValidateData(category, title, description, serviceType, skillTradeOption),
                        "Creating service failed");
        }