private void EnsureMandatoryValuesAreProvided(NonMediaCostData nonMediaCostData, bool isHideClassification)
        {
            var dataErrorFound         = false;
            var nonMediaCostDataErrors = new StringBuilder();

            nonMediaCostDataErrors.Append("The feature file " + FeatureContext.FeatureInfo.Title + " has the following data issues:");

            if (string.IsNullOrWhiteSpace(nonMediaCostData.Name))
            {
                dataErrorFound = true;
                nonMediaCostDataErrors.Append("\n- Mandatory field Name is not available in test data file");
            }

            if (isHideClassification && string.IsNullOrWhiteSpace(nonMediaCostData.Category))
            {
                dataErrorFound = true;
                nonMediaCostDataErrors.Append("\n- Mandatory field Category is not available in test data file");
            }

            if (string.IsNullOrWhiteSpace(nonMediaCostData.Vendor))
            {
                dataErrorFound = true;
                nonMediaCostDataErrors.Append("\n- Mandatory field Vendor is not available in test data file");
            }

            if (dataErrorFound)
            {
                throw new ArgumentException(nonMediaCostDataErrors.ToString());
            }
        }
Beispiel #2
0
 private void SetAddOtherCostData(NonMediaCostData othercostData)
 {
     SelectWebformDropdownValueByText(_ddlCountry, othercostData.Country);
     SelectWebformDropdownValueByText(_ddlCategory, othercostData.Category);
     SelectWebformDropdownValueByText(_ddlVendor, othercostData.Vendor);
     ClearInputAndTypeValue(_txtAgencyCost, othercostData.AgencyCost);
     ClearInputAndTypeValue(_txtDescription, othercostData.Description);
     ClickElement(_btnSave);
 }
Beispiel #3
0
        private void EnsureMandatoryValuesAreProvided(NonMediaCostData othercostData)
        {
            var dataErrorFound      = false;
            var otherCostDataErrors = new StringBuilder();

            otherCostDataErrors.Append("The feature file " + FeatureContext.FeatureInfo.Title + " has the following data issues:");

            if (string.IsNullOrWhiteSpace(othercostData.AgencyCost))
            {
                dataErrorFound = true;
                otherCostDataErrors.Append("\n- Mandatory field Agency Cost is not available in test data file");
            }

            if (string.IsNullOrWhiteSpace(othercostData.Country))
            {
                dataErrorFound = true;
                otherCostDataErrors.Append("\n- Mandatory field Country is not available in test data file");
            }

            if (string.IsNullOrWhiteSpace(othercostData.Description))
            {
                dataErrorFound = true;
                otherCostDataErrors.Append("\n- Mandatory field Description is not available in test data file");
            }

            if (string.IsNullOrWhiteSpace(othercostData.Category))
            {
                dataErrorFound = true;
                otherCostDataErrors.Append("\n- Mandatory field Category is not available in test data file");
            }

            if (string.IsNullOrWhiteSpace(othercostData.Vendor))
            {
                dataErrorFound = true;
                otherCostDataErrors.Append("\n- Mandatory field Vendor is not available in test data file");
            }

            if (dataErrorFound)
            {
                throw new ArgumentException(otherCostDataErrors.ToString());
            }
        }
        private void SetNonMediaCostData(NonMediaCostData nonMediaCostData, bool isHideClassification)
        {
            WaitForElementToBeVisible(_txtName);
            ClearInputAndTypeValue(_txtName, nonMediaCostData.Name);

            if (isHideClassification)
            {
                SelectSingleValueFromReactDropdownByText(_ddlCategory, nonMediaCostData.Category);
            }
            SelectSingleValueFromReactDropdownByText(_ddlVendor, nonMediaCostData.Vendor);

            if (string.IsNullOrWhiteSpace(nonMediaCostData.StartDate))
            {
                nonMediaCostData.StartDate = GetTodaysDate();
            }

            if (string.IsNullOrWhiteSpace(nonMediaCostData.EndDate))
            {
                nonMediaCostData.EndDate = GetTodaysDate();
            }

            EnterDate(_txtStartDate, nonMediaCostData.StartDate);
            EnterDate(_txtEndDate, nonMediaCostData.EndDate);

            if (!string.IsNullOrWhiteSpace(nonMediaCostData.PurchaseOrderNumber))
            {
                SelectSingleValueFromReactDropdownByText(_ddlPurchaseOrderNumber, nonMediaCostData.PurchaseOrderNumber);
            }

            if (!string.IsNullOrWhiteSpace(nonMediaCostData.AgencyCost))
            {
                ClearInputAndTypeValue(_txtAgencyCost, nonMediaCostData.AgencyCost);
            }

            if (!string.IsNullOrWhiteSpace(nonMediaCostData.Comment))
            {
                ClearInputAndTypeValue(_txtComments, nonMediaCostData.Comment);
            }
        }
 public void AddNonMediaCost(NonMediaCostData nonMediaCostData, bool isHideClassification)
 {
     EnsureMandatoryValuesAreProvided(nonMediaCostData, isHideClassification);
     SetNonMediaCostData(nonMediaCostData, isHideClassification);
 }