protected void btnOK_Click(object sender, EventArgs e) { if (ValidationFunctions.IsValidDateRange(txtRequiredDateFrom.Text, txtRequiredDateTo.Text)) { lblResultsRFromWh.Text = ddlFromWarehouse.SelectedItem.Text + " - " + lblWareHousedesc.Text; lblResultsRToWh.Text = ddlToWarehouse.SelectedItem.Text + " - " + lblToWareHouseDesc.Text; lblResultsRFromLoc.Text = ddlFromLocation.SelectedItem.Text + " - " + lblLocationdesc.Text; lblResultsRToLoc.Text = ddlToLocation.SelectedItem.Text.Trim() + " - " + lblToLocationDesc.Text; lblReqFrom.Text = txtRequiredDateFrom.Text; lblReqTo.Text = txtRequiredDateTo.Text; // view Request Modification Labels lblvmrRFromWh.Text = ddlFromWarehouse.SelectedItem.Text + " - " + lblWareHousedesc.Text; lblvmrRToWh.Text = ddlToWarehouse.SelectedItem.Text + " - " + lblToWareHouseDesc.Text; lblvmrRFromLoc.Text = ddlFromLocation.SelectedItem.Text + " - " + lblLocationdesc.Text; lblvmrRToLoc.Text = ddlToLocation.SelectedItem.Text.Trim() + " - " + lblToLocationDesc.Text; lblvmrReqDateFrom.Text = txtRequiredDateFrom.Text; lblvmrReqDateTo.Text = txtRequiredDateTo.Text; mvRequisitionInquiry.SetActiveView(vwResults); lblErrorMessage.Text = ""; BindGrid(); } else { lblErrorMessage.Text = "Not a Valid Date range"; } }
public void Test_isDistanceValid_when_distance_is_not_number_then_return_false() { Random random = new Random(); ValidationFunctions functions = new ValidationFunctions(); bool result = functions.isDistanceValid("test" + random.NextDouble()); Assert.AreEqual(false, result); }
public void Test_isUsedOperatorValid_when_method_input_greater_then_10_then_method_returns_false() { Random random = new Random(); ValidationFunctions functions = new ValidationFunctions(); bool result = functions.isUsedOperatorValid(random.Next(11, 1000)); Assert.AreEqual(false, result); }
public bool VerifyLoginInput(string email, string password) { if (!ValidationFunctions.IsValidEmail(email) || password.Length < 6) { return(false); } return(true); }
/// <summary> /// Gets a value that indicates whether this attribute is a match for the specified validation rule result. /// </summary> /// <remarks> /// <para> /// This method is used to determine whether a class decorated with this attribute is eligible to be used to /// provide a message for the specified result. /// </para> /// </remarks> /// <param name="result">A validation rule result.</param> /// <returns><see langword="true" /> if this attribute matches the specified result; <see langword="false" /> otherwise.</returns> /// <exception cref="ArgumentNullException">If the <paramref name="result"/> is <see langword="null" />.</exception> public bool IsMatch(ValidationRuleResult result) { if (result is null) { throw new ArgumentNullException(nameof(result)); } return(ValidationFunctions.All(func => func(result))); }
public ValidationRunner() { validationFunctions = new Dictionary <ValueTypes, Func <object, IValidationResult> > { { ValueTypes.String, (value) => ValidationFunctions.ValidateStringValue(value) }, { ValueTypes.Int, (value) => ValidationFunctions.ValidateIntObject(value) }, { ValueTypes.Lattitude, (value) => ValidationFunctions.ValidateLattitude(value) }, { ValueTypes.Longitude, (value) => ValidationFunctions.ValidateLongitude(value) } }; }
public void Test_isPredicateValid_returns_false_when_list_is_empty() { Random random = new Random(); List <int> output = new List <int>(); ValidationFunctions functions = new ValidationFunctions(); bool result = functions.isPredicateValid(output, random.Next(-1000, 0), random.Next(1001, 9999)); Assert.AreEqual(false, result); }
public void Test_IsValidGeoJson_when_input_starts_wrong_returns_false1() { Random random = new Random(); string input = "[\"type\": \"Feature\",\"geometry\": {\"type\": \"Point\",\"coordinates\": [" + random.Next(100) + ", " + random.Next(100) + "]},\"properties\": {\"name\": \"Dinagat Islands\"}}"; ValidationFunctions functions = new ValidationFunctions(); bool result = functions.IsValidGeoJson(input); Assert.AreEqual(false, result); }
public void Test_IIsValidGeoJsonArray_when_geoJSON_array_is_invalid() { Random random = new Random(); string input = "[{\"type\": Feature,\"geometry\": {\"type\": \"Point\",\"coordinates\": [" + random.Next(100) + ", " + random.Next(100) + "]},\"properties\": {\"name\": \"Dinagat Islands\"}}]"; ValidationFunctions functions = new ValidationFunctions(); bool result = functions.IsValidGeoJsonArray(input); Assert.AreEqual(false, result); }
public MatterProvision(IMatterRepository matterRepositoy, IOptions <MatterSettings> matterSettings, IOptions <ErrorSettings> errorSettings, ISPOAuthorization spoAuthorization, IEditFunctions editFunctions, ValidationFunctions validationFunctions, ICustomLogger customLogger, IOptions <LogTables> logTables, IOptions <MailSettings> mailSettings) { this.matterRepositoy = matterRepositoy; this.matterSettings = matterSettings.Value; this.spoAuthorization = spoAuthorization; this.editFunctions = editFunctions; this.errorSettings = errorSettings.Value; this.customLogger = customLogger; this.logTables = logTables.Value; this.validationFunctions = validationFunctions; this.mailSettings = mailSettings.Value; }
public MatterProvision(IMatterRepository matterRepositoy, IOptions<MatterSettings> matterSettings, IOptions<ErrorSettings> errorSettings, ISPOAuthorization spoAuthorization, IEditFunctions editFunctions, ValidationFunctions validationFunctions, ICustomLogger customLogger, IOptions<LogTables> logTables, IOptions<MailSettings> mailSettings) { this.matterRepositoy = matterRepositoy; this.matterSettings = matterSettings.Value; this.spoAuthorization = spoAuthorization; this.editFunctions = editFunctions; this.errorSettings = errorSettings.Value; this.customLogger = customLogger; this.logTables = logTables.Value; this.validationFunctions = validationFunctions; this.mailSettings = mailSettings.Value; }
public bool VerifyUpdateUserInput(string email, string passwordCurrent, string passwordNew) { if (!ValidationFunctions.IsValidEmail(email)) { return(false); } if (!ValidationFunctions.IsValidPassword(passwordCurrent)) { return(false); } if (!ValidationFunctions.IsValidPassword(passwordNew)) { return(false); } return(true); }
public bool VerifyRegisterInput(string email, string password, string firstName, string lastName, string role, string age, IPlayerRepository playerRepository, ITrainerRepository trainerRepository) { if (!ValidationFunctions.IsValidEmail(email)) { return(false); } if (!ValidationFunctions.IsValidPassword(password)) { return(false); } if (!ValidationFunctions.IsValidName(new string[] { firstName, lastName })) { return(false); } if (role == "Player" && !ValidationFunctions.IsValidAge(age)) { return(false); } if (role == "") { return(false); } switch (role) { case "Player": { if (RegisterPlayer(email, password, firstName, lastName, age, playerRepository, trainerRepository)) { return(true); } return(false); } case "Trainer": { if (RegisterTrainer(email, password, firstName, lastName, trainerRepository, playerRepository)) { return(true); } return(false); } case "": return(false); } return(false); }
protected void btnOK_Click(object sender, EventArgs e) { if (ValidationFunctions.IsValidDateRange(txtRequestedDateFrom.Text, txtRequestedDateTo.Text)) { lblResultsRToWh.Text = ddlToWarehouse.SelectedItem.Text + " - " + lblToWareHouseDesc.Text; lblResultsRToLoc.Text = ddlToLocation.SelectedItem.Text + " - " + lblToLocationDesc.Text; lblReqFrom.Text = txtRequestedDateFrom.Text; lblReqTo.Text = txtRequestedDateTo.Text; mvSupply.SetActiveView(vwResults); lblErrorMessage.Text = ""; BindGrid(); } else { lblErrorMessage.Text = "Not a Valid Date range"; } }
public void Test_isPredicateValid_returns_false_when_one_number_in_array_equal_or_lower_then_from() { Random random = new Random(); List <int> output = new List <int>(); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(-1000, -100)); ValidationFunctions functions = new ValidationFunctions(); bool result = functions.isPredicateValid(output, random.Next(-100, 0), random.Next(1001, 9999)); Assert.AreEqual(false, result); }
protected void btnOK_Click(object sender, EventArgs e) { if (txtRequiredDateFrom.Text != "" && txtRequiredDateTo.Text == "" && revRequiredDateTo.IsValid) { txtRequiredDateTo.Text = txtRequiredDateFrom.Text; } if (ValidationFunctions.IsValidDateRange(txtRequiredDateFrom.Text, txtRequiredDateTo.Text)) { lblResultsRFromWh.Text = ddlFromWarehouse.SelectedItem.Text + " - " + lblWareHousedesc.Text; lblResultsRToWh.Text = ddlToWarehouse.SelectedItem.Text + " - " + lblToWareHouseDesc.Text; lblResultsRFromLoc.Text = ddlFromLocation.SelectedItem.Text + " - " + lblLocationdesc.Text; lblResultsRToLoc.Text = ddlToLocation.SelectedItem.Text.Trim() + " - " + lblToLocationDesc.Text; lblReqFrom.Text = txtRequiredDateFrom.Text; lblReqTo.Text = txtRequiredDateTo.Text; MultiView1.SetActiveView(vwResults); lblErrorMessage.Text = ""; BindGrid(); } else { lblErrorMessage.Text = "Not a Valid Date range"; } }
public void Test_isPredicateValid_returns_true_then_numbers_in_array_greater_then_from_and_lower_then_to() { Random random = new Random(); List <int> output = new List <int>(); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); output.Add(random.Next(1, 1000)); ValidationFunctions functions = new ValidationFunctions(); bool result = functions.isPredicateValid(output, random.Next(-1000, 0), random.Next(1001, 9999)); Assert.AreEqual(true, result); }
public bool Test_isUsedOperatorValid(int output) { ValidationFunctions functions = new ValidationFunctions(); return(functions.isUsedOperatorValid(output)); }
public UsersBLL(IGreatRepository <User> context) : base(context) { _validationFunctions = new ValidationFunctions(); _regexFunctions = new RegexFunctions(); }