public void Init() { Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us"); validator = new DateTimeValidator(); validator.Initialize(new CachedValidationRegistry(), typeof(TestTarget).GetProperty("DtField")); target = new TestTarget(); }
public void TestSearchField(Enums.ResourceType resourceType, string fieldName, string condition) { string fieldAlias = $"{resourceType.ToResourceName()}.{fieldName}"; Dictionary <string, string> parameters = new Dictionary <string, string>() { { DateTimeValidator.FieldAlias1, fieldAlias }, { DateTimeValidator.Condition1, condition }, { DateTimeValidator.ConditionValue1, testData.Random() }, { DateTimeValidator.ConditionValue2, testData.Random() }, }; //Read & verify the field's value DateTimeValidator.VerifySingleSearchFieldDate(resourceType, parameters, false); }
public void TestParameterNotEqualToPasses( string parameterName, DateTime parameterValue, DateTime valueToCompare, DateTimeValidator validatorBase) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter value is equal to the value to compare against" .x(() => validatorBase.IsNotEqualTo(valueToCompare).OtherwiseThrowException()); "Should not result in an exception" .x(() => validatorBase.CurrentException.Should().BeNull()); }
public void TestSearchMultipleSearchConditionUsingMultiField(Enums.ResourceType resourceType, List <string> fieldValues, string condition1, string condition2) { string resourceName = resourceType.ToResourceName(); string fieldAlias1 = customFields.Data[$"{resourceType}-{Field1}"].Field.ToAlias(); string fieldAlias2 = customFields.Data[$"{resourceType}-{Field2}"].Field.ToAlias(); string fieldError = "Cannot create a user field for " + resourceName; Assume.That(fieldAlias1, Is.Not.Null.And.Not.Empty, fieldError); Assume.That(fieldAlias2, Is.Not.Null.And.Not.Empty, fieldError); Dictionary <string, string> parameters = FieldHelper.CreateMultipleFieldSearchInstance(records, cleaner, resourceType, fieldAlias1, fieldAlias2, fieldValues, condition1, condition2); //Read & verify the field's value DateTimeValidator.VerifySearchDate(resourceType, parameters); }
public void TestSearchMultipleSearchConditionUsingMultiField(Enums.ResourceType resourceType, List <string> fieldValues, string condition1, string condition2) { string resourceName = resourceType.ToResourceName(); string fieldAlias1 = $"{resourceName}.{AppField1}"; string fieldAlias2 = $"{resourceName}.{AppField2}"; //Check registered application field FieldHelper.CheckRegisteredField(readFields, resourceType, AppField1); FieldHelper.CheckRegisteredField(readFields, resourceType, AppField2); Dictionary <string, string> parameters = FieldHelper.CreateMultipleFieldSearchInstance(records, cleaner, resourceType, fieldAlias1, fieldAlias2, fieldValues, condition1, condition2); //Read & verify the field's value DateTimeValidator.VerifySearchDate(resourceType, parameters, false); }
public async Task <IActionResult> SaveCustomer([FromBody] CreateCustomerRequest request) { var errorInfo = new ErrorInfo(); // Validate Fullname errorInfo = FullNameValidator.Validate(request.FullName, out string fullName); if (errorInfo.ErrorCode != ErrorTypes.OK) { throw new BadInputException(errorInfo); } // Validate Date of Birth errorInfo = DateTimeValidator.Validate(request.DateOfBirth, out DateTime? validDate); if (errorInfo.ErrorCode != ErrorTypes.OK) { throw new BadInputException(errorInfo); } // Check if user already exists var user = await _customerRepository.GetCustomerByFullNameAsync(fullName, validDate); if (user?.Id != null) { errorInfo.ErrorCode = ErrorTypes.InvalidFullName; errorInfo.ErrorMessage = $"This name '{fullName}' is already exists."; throw new BadInputException(errorInfo); } // Validate ICollection Address foreach (var item in request.Address) { errorInfo = AddressValidator.Validate(item); if (errorInfo.ErrorCode != ErrorTypes.OK) { throw new BadInputException(errorInfo); } } // Map request into model var customerModel = _mapper.Map <CustomerModel>(request); customerModel.DateOfBirth = validDate; customerModel.FullName = fullName; await _customerRepository.CreateCustomerAsync(customerModel); return(Ok(customerModel)); }
/// <summary> /// Verifying a search date /// </summary> /// <param name="resourceType">Resource type</param> /// <param name="searchParameters">Search parameters</param> /// <param name="extraUrlParameters">Extra url parameters</param> /// <param name="isDate">True/False</param> public static void VerifySearchDate(Enums.ResourceType resourceType, SearchParameters searchParameters, int resultCode, Dictionary <string, object> extraUrlParameters = null, bool isDate = true) { string firstFieldAlias = searchParameters.FirstFieldAlias; string secondFieldAlias = searchParameters.SecondFieldAlias; string firstCondition = searchParameters.FirstCondition; string secondCondition = searchParameters.SecondCondition; string firstCondValue = searchParameters.FirstCondValue.ToString(); string secondCondValue = searchParameters.SecondCondValue.ToString(); string formatCond = DateTimeValidator.GetFormatCondition(firstFieldAlias, secondFieldAlias, firstCondition, secondCondition, firstCondValue, secondCondValue); Dictionary <string, object> urlParameters = new Dictionary <string, object>() { { "partition", AuthenticationInfoProvider.Current.DefaultPartition }, { "condition", formatCond }, { "field", firstFieldAlias == secondFieldAlias ? firstFieldAlias : string.Format("{0},{1}", firstFieldAlias, secondFieldAlias) } }; if (extraUrlParameters != null) { urlParameters = urlParameters.Concat(extraUrlParameters).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.First().Value); } if (resultCode == Enums.PublicAPIResultCode.DateTimeOutOfRange) { var result = PublicApiAdapter.CreateAdapterForDefaultConnection().ReadFail(resourceType.ToString(), urlParameters); Assert.That(result, MustBe.MatchingErrorCode(resultCode), Enums.Message.WRONG_ERROR_CODE); } else { var result = PublicApiAdapter.CreateAdapterForDefaultConnection().ReadSuccess(resourceType.ToString(), urlParameters); Assert.That(result, MustBe.ReadSuccess(0), string.Format(Enums.Message.READ_RESOURCE_FAILED, resourceType.ToString())); Assert.IsNotNull(result.Items, string.Format(Enums.Message.READ_RESOURCE_FAILED, resourceType.ToString())); Assert.That(result.Count, Is.GreaterThanOrEqualTo(0), Enums.Message.COUNT_ERROR); Assert.That(result.Items.Count, Is.GreaterThanOrEqualTo(0), Enums.Message.COUNT_ERROR); if (firstFieldAlias == secondFieldAlias) { VerifyValueOneField(result.Items, searchParameters, isDate); } else { VerifyValueMultipleField(result.Items, searchParameters, isDate); } } }
public void TestParameterEqualToFails( string parameterName, DateTime parameterValue, DateTime valueToCompare, DateTimeValidator validatorBase, Action act) { "Given a new ValidatorBase" .x(() => validatorBase = Validate.That(parameterName, parameterValue)); "Testing that the parameter value is equal to the value to compare against" .x(() => act = () => validatorBase.IsEqualTo(valueToCompare).OtherwiseThrowException()); "Should throw an exception" .x(() => act.ShouldThrow <ArgumentEqualityException>() .WithMessage(string.Format(Resources.MustBeEqualToX + "\r\nParameter name: {1}", valueToCompare, parameterName))); }
public void TestReadValidInput(Enums.ResourceType resourceType, string fieldName, ReadValidInput valueType) { string resourceName = resourceType.ToResourceName(); string fieldAlias = string.Format("{0}.{1}", resourceName, fieldName); string fieldValue = FieldValueMapperRead.ValidInputMapper[valueType]; XmlResource resource = ResourceHelper.CreateResourceInstance(records, resourceType); resource.DictionaryValues[fieldAlias] = fieldValue; string id = ResourceHelper.WriteResource(resource, cleaner); Assert.That(id, Is.Not.Null.And.Not.Empty, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceName)); //Read & verify the field's value DateTimeValidator.ReadAndVerifyDate(resourceType, id, fieldAlias, fieldValue); }
public void TestMultipleSearch1NumberField(string fieldName, string condition1, string condition2) { condition1 = condition1.ToLowerString(); condition2 = condition2.ToLowerString(); string conditionValue1 = string.Empty; string conditionValue2 = string.Empty; conditionValue1 = PhaseHelper.GeneratePhaseNumberType(defaultResource, fieldName, indexFirstPhaseList); //Get phase value by public api because read phase private api could not retrieve RegistrationDate, Option alias conditionValue2 = PhaseHelper.GeneratePhaseNumberType(defaultResource, fieldName, indexSecondPhaseList); //Get phase value by public api because read phase private api could not retrieve RegistrationDate, Option alias //Read & verify the field's value if (fieldName == PhaseApiFields.RegistrationDate || fieldName == PhaseApiFields.UpdateDate || fieldName == PhaseApiFields.Date) { Dictionary <string, string> conditionParameters = new Dictionary <string, string>() { { DateTimeValidator.FieldAlias1, fieldName }, { DateTimeValidator.FieldAlias2, fieldName }, { DateTimeValidator.Condition1, condition1 }, { DateTimeValidator.Condition2, condition2 }, { DateTimeValidator.ConditionValue1, conditionValue1 }, { DateTimeValidator.ConditionValue2, conditionValue2 }, }; SystemFieldTypeHelper.VerifySearchDatePhase(defaultResource, conditionParameters, false); } else { string formatCond = DateTimeValidator.GetFormatCondition(fieldName, fieldName, condition1, condition2, conditionValue1, conditionValue2); Dictionary <string, object> parameters = new Dictionary <string, object>() { { PhaseApiFields.Partition, AuthenticationInfoProvider.Current.DefaultPartition }, { PhaseApiFields.Resource, (int)defaultResource }, { PhaseApiFields.Condition, formatCond }, { PhaseApiFields.Field, fieldName }, }; ReadResponseData <Phase> result = PublicApiAdapter.CreateAdapterForDefaultConnection().ReadSuccess <Phase>(parameters); Assert.That(result.Code, Is.EqualTo(Enums.PublicAPIResultCode.Success), string.Format(Enums.Message.READ_RESOURCE_FAILED, nameof(Phase))); foreach (var item in result.Items) { Assert.That(int.Parse(item.DictionaryValues[fieldName].ToString()), DateTimeValidator.ConditionsMap[condition1](int.Parse(conditionValue1), int.Parse(conditionValue2)).And.Matches(DateTimeValidator.ConditionsMap[condition2](int.Parse(conditionValue2), int.Parse(conditionValue1))), DateTimeValidator.ErrorMessage); } } }
public void TestReadValidInput(Enums.ResourceType resourceType, ReadValidInput valueType) { string fieldAlias = customFields.Data[$"{resourceType}"].Field.ToAlias(); Assume.That(fieldAlias, Is.Not.Null.And.Not.Empty, "Cannot create a user field for " + resourceType); string fieldValue = FieldValueMapperRead.ValidInputMapper[valueType]; XmlResource resource = ResourceHelper.CreateResourceInstance(records, resourceType); resource.DictionaryValues[fieldAlias] = fieldValue; string id = ResourceHelper.WriteResource(resource, cleaner); Assert.That(id, Is.Not.Null.And.Not.Empty, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType.ToString())); //Read & verify the field's value DateTimeValidator.ReadAndVerifyDate(resourceType, id, fieldAlias, fieldValue); }
public void TestSearchMultipleSearchConditionUsingMultiField(Enums.ResourceType resourceType, string fieldName1, string fieldName2, string condition1, string condition2) { string fieldAlias1 = $"{resourceType.ToResourceName()}.{fieldName1}"; string fieldAlias2 = $"{resourceType.ToResourceName()}.{fieldName2}"; Dictionary <string, string> parameters = new Dictionary <string, string>() { { DateTimeValidator.FieldAlias1, fieldAlias1 }, { DateTimeValidator.FieldAlias2, fieldAlias2 }, { DateTimeValidator.Condition1, condition1 }, { DateTimeValidator.Condition2, condition2 }, { DateTimeValidator.ConditionValue1, testData["data2"] }, { DateTimeValidator.ConditionValue2, testData["data4"] }, }; //Read & verify the field's value DateTimeValidator.VerifySearchDate(resourceType, parameters, false); }
public void TestReadValidInput(Enums.ResourceType resourceType, ReadValidInput valueType) { string fieldAlias = $"{resourceType.ToResourceName()}.{AppField}"; string fieldValue = FieldValueMapperRead.ValidInputMapper[valueType]; //Check registered application field FieldHelper.CheckRegisteredField(readFields, resourceType, AppField); XmlResource resource = ResourceHelper.CreateResourceInstance(records, resourceType); resource.DictionaryValues[fieldAlias] = fieldValue; string id = ResourceHelper.WriteResource(resource, cleaner); Assert.That(id, Is.Not.Null.And.Not.Empty, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, resourceType.ToString())); //Read & verify the field's value DateTimeValidator.ReadAndVerifyDate(resourceType, id, fieldAlias, fieldValue); }
public void TestSearchOrderField(Enums.ResourceType resourceType, List <string> fieldValues, string order) { Assume.That(customFields.Data, Is.Not.Null, "HrbcFieldCreator cannot create custom fields!"); string fieldName1 = customFields.Data[$"{resourceType}-{Fields.First()}"].Name; string fieldName2 = customFields.Data[$"{resourceType}-{Fields.Last()}"].Name; string msgError = "Cannot create a user field for " + resourceType; Assume.That(fieldName1, Is.Not.Null.And.Not.Empty, msgError); Assume.That(fieldName2, Is.Not.Null.And.Not.Empty, msgError); List <string> fieldsName = new List <string> { fieldName1, fieldName2 }; List <WriteResultItem> ids = FieldHelper.CreateOrderInstance(records, cleaner, resourceType, fieldsName, fieldValues); //Read & verify the field's value DateTimeValidator.VerifyOrderFieldDate(resourceType, fieldsName, fieldValues, order, ids); }
public void TestReadValidInputPhase(string fieldName, ReadValidInput valueType) { Enums.ResourceType resourceType = Enums.ResourceType.Client; string fieldValue = FieldValueMapperRead.ValidInputMapper[valueType]; string id = recordsWithoutFieldInput.Data[$"{resourceType.ToPrivateEnum()}0"].Id.ToString(); var phase = FieldHelper.CreatePhaseInstance(resourceType, id); if (valueType != ReadValidInput.NotSpecifiedDate) { phase.DictionaryValues[fieldName] = fieldValue; } id = ResourceHelper.WriteResource(phase, null); Assume.That(id, Is.Not.Null.And.Not.Empty, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, nameof(Phase))); //Read & verify the field's value if (valueType != ReadValidInput.NotSpecifiedDate) { DateTimeValidator.ReadAndVerifyDateForPhase(resourceType, id, fieldName, fieldValue); } else { DateTimeValidator.ReadAndVerifyAutoDesignatedDateForPhase(resourceType, id, fieldName); } if (valueType == ReadValidInput.NoValidation) { fieldValue = Util.ParseDateTime(FieldValueMapperRead.ValidInputMapper[ReadValidInput.NoValidation]).AddDays(1).ToString(); var phaseUpdate = new Phase { Id = id, }; phaseUpdate.DictionaryValues[fieldName] = fieldValue; id = ResourceHelper.WriteResource(phaseUpdate, null); Assume.That(id, Is.Not.Null.And.Not.Empty, string.Format(Enums.Message.CREATE_RESOURCE_ENTRY_FAILED, nameof(Phase))); DateTimeValidator.ReadAndVerifyNoValidationDateForPhase(resourceType, id, fieldName); } }
/// <summary> /// Calculate Method /// </summary> /// <param name="theDateTime"></param> /// <returns></returns> public static int Calculate(string theDateTime) { var errorInfo = new ErrorInfo(); // Validate Date of Birth errorInfo = DateTimeValidator.Validate(theDateTime, out DateTime? validDate); if (errorInfo.ErrorCode != ErrorTypes.OK) { throw new BadInputException(errorInfo); } int age = DateTime.Today.Year - validDate.Value.Year; if (validDate.Value.AddYears(age) > DateTime.Today) { age--; } return(age); }
public static IValidator GetValidator(ValueType valueType) { IValidator validator = null; switch (valueType) { case ValueType.Datetime: validator = new DateTimeValidator(); break; case ValueType.String: validator = new StringValidator(); break; case ValueType.Integer: validator = new IntergerValidator(); break; } return(validator); }
public void TestValidSingleSearchNumberField(string fieldName, string condition) { string conditionValue1 = PhaseHelper.GeneratePhaseNumberType(defaultResource, fieldName, indexFirstPhaseList); string conditionValue2 = PhaseHelper.GeneratePhaseNumberType(defaultResource, fieldName, indexSecondPhaseList); string tempCond = $"{fieldName}:{condition}={conditionValue1}"; string formatCond = condition == DateTimeValidator.Or ? $"{tempCond}:{conditionValue2}" : tempCond; Dictionary <string, object> parameters = new Dictionary <string, object>() { { PhaseApiFields.Partition, AuthenticationInfoProvider.Current.DefaultPartition }, { PhaseApiFields.Resource, (int)defaultResource }, { PhaseApiFields.Condition, formatCond }, { PhaseApiFields.Field, fieldName }, }; ReadResponseData <Phase> result = PublicApiAdapter.CreateAdapterForDefaultConnection().ReadSuccess <Phase>(parameters); Assert.That(result.Code, Is.EqualTo(Enums.PublicAPIResultCode.Success), string.Format(Enums.Message.READ_RESOURCE_FAILED, nameof(Phase))); //Read & verify the field's value if (fieldName == PhaseApiFields.RegistrationDate || fieldName == PhaseApiFields.UpdateDate || fieldName == PhaseApiFields.Date) { Dictionary <string, string> conditionParameters = new Dictionary <string, string>() { { DateTimeValidator.FieldAlias1, fieldName }, { DateTimeValidator.Condition1, condition }, { DateTimeValidator.ConditionValue1, conditionValue1 }, { DateTimeValidator.ConditionValue2, conditionValue2 }, }; DateTimeValidator.VerifySingleSearchSystemFieldPhase(defaultResource, conditionParameters); } else { foreach (var item in result.Items) { DateTimeValidator.ConditionalAssertions[condition](int.Parse(item.DictionaryValues[fieldName].ToString()), int.Parse(conditionValue1), int.Parse(conditionValue2)); } } }
public Release(DateTime ReleasedAt, String Sha1String, ReleaseDownloadUrl ReleaseDownloadUrl, ReleaseFileName ReleaseFileName, ModVersion ModVersion, FactorioVersion FactorioVersion, List <Dependency> Dependencies) { DateTimeValidator.ValidateRequiredDateTimeBeforePresent(ReleasedAt, nameof(ReleasedAt)); ObjectValidator.ValidateRequiredObject(Sha1String, nameof(Sha1String)); ObjectValidator.ValidateRequiredObject(ReleaseDownloadUrl, nameof(ReleaseDownloadUrl)); ObjectValidator.ValidateRequiredObject(ReleaseFileName, nameof(ReleaseFileName)); ObjectValidator.ValidateRequiredObject(ModVersion, nameof(ModVersion)); ObjectValidator.ValidateRequiredObject(FactorioVersion, nameof(FactorioVersion)); ListValidator.ValidateRequiredListNotEmpty(Dependencies, nameof(Dependencies)); Regex sha1CaptureRegex = new Regex(Release.Sha1CapturePattern); Match match = sha1CaptureRegex.Match(Sha1String); if (!match.Success) { throw new ArgumentException($"Unable to parse \"{Sha1String}\" to a valid SHA-1 hash due to formatting.", "Sha1String"); } String sha1 = match.Groups[1].Value; if (sha1.Length != Sha1Length) { throw new ArgumentException($"Unable to parse \"{Sha1String}\" to a valid SHA-1 hash due to length. The SHA-1 hash must have a length of exactly {Release.Sha1Length} characters.", "Sha1String"); } if (ModVersion != ReleaseFileName.ModVersion) { throw new ArgumentException("The specified release file name version does not match the specified release version.", "ReleaseFileName"); } this.ReleasedAt = ReleasedAt; this.ReleaseDownloadUrl = new ReleaseDownloadUrl(ReleaseDownloadUrl); this.ReleaseFileName = new ReleaseFileName(ReleaseFileName); this.Sha1 = sha1; this.ModVersion = new ModVersion(ModVersion); this.FactorioVersion = new FactorioVersion(FactorioVersion); // TODO: We may want to write an .AddDependency() method that validates that the dependency we're adding isn't for the release/mod itself. That would generate a circular dependency. this.Dependencies = Dependencies.ConvertAll(dependency => new Dependency(dependency)); }
public void DateTime_Validator_Test() { var sut = new DateTimeValidator(); var col1 = new ColumnTypeInfo() { AllowNull = true }; var col2 = new ColumnTypeInfo() { AllowNull = false }; Assert_Valid(sut.Validate(col1, "1/1/2016")); Assert_Valid(sut.Validate(col1, new DateTime(2016, 1, 1))); Assert_Invalid(sut.Validate(col1, "Foo")); Assert_Invalid(sut.Validate(col1, "2/29/2015")); Assert_Invalid_Replaced(sut.Validate(col2, "Foo"), SqlDateTime.MinValue); Assert_Invalid_Replaced(sut.Validate(col2, "2/29/2015"), SqlDateTime.MinValue); Assert_Invalid_Replaced(sut.Validate(col2, DBNull.Value), SqlDateTime.MinValue); }
public void Validate_Max_AreEqual(string value, bool isValid) { DateTimeValidator validator = DateTimeValidator.CreateMaxDateTime("", value, new DateTime(1912, 3, 2)); Assert.AreEqual(validator.Validate(), isValid); }
public static DateTimeValidator That(string nameOfParameter, DateTime parameterValue) { return(DateTimeValidator.GetInstance(nameOfParameter, parameterValue)); }
public void CreateDateTimeValidatorExpectSuccess() { var validator = new DateTimeValidator(); Assert.IsFalse(validator.AllowNullValues); }
public void Validate_Format_AreEqual(string value, bool isValid) { DateTimeValidator validator = new DateTimeValidator("", value); Assert.AreEqual(validator.Validate(), isValid); }
public async Task <IActionResult> UpdateCustomer(int id, UpdateCustomerRequest request) { var errorInfo = new ErrorInfo(); // Verify customer identifier from route and request body errorInfo = IdentifierValidator.Validate(id, request.CustomerIdentifier); if (errorInfo.ErrorCode != ErrorTypes.OK) { throw new BadInputException(errorInfo); } // Find customer to update var currentCustomer = await _customerRepository.GetCustomerByIdentifierAsync(id); // Customer errorInfo = CustomerObjectValidator.Validate(currentCustomer, id); if (errorInfo.ErrorCode != ErrorTypes.OK) { throw new BadInputException(errorInfo); } bool isModified = false; // Fullname if (request.FullName != null && currentCustomer.FullName != request.FullName) { errorInfo = FullNameValidator.Validate(request.FullName, out string fullName); if (errorInfo.ErrorCode != ErrorTypes.OK) { throw new BadInputException(errorInfo); } isModified = true; currentCustomer.FullName = fullName; } // Date of Birth if (request.DateOfBirth != null && currentCustomer.DateOfBirth.ToString() != request.DateOfBirth) { errorInfo = DateTimeValidator.Validate(request.DateOfBirth, out DateTime? validDate); if (errorInfo.ErrorCode != ErrorTypes.OK) { throw new BadInputException(errorInfo); } isModified = true; currentCustomer.DateOfBirth = validDate; currentCustomer.Age = CalculateAge.Calculate(request.DateOfBirth); } // Validate ICollection Address if (request?.Address != null) { foreach (var item in request.Address) { errorInfo = AddressValidator.Validate(item); if (errorInfo.ErrorCode != ErrorTypes.OK) { throw new BadInputException(errorInfo); } } isModified = true; currentCustomer.Address = _mapper.Map <List <AddressModel> >(request.Address); } if (isModified) { // TODO: To implement the updated and created date in Model // newCustomer.UpdatedDate = DateTime.UtcNow; await _customerRepository.UpdateCustomerAsync(currentCustomer); } // Map Journal Model to Journal Dto var resultDto = _mapper.Map <CustomerDto>(currentCustomer); return(Ok(resultDto)); }
public Func <string, string, DateTimeValidator> MaxDateTime(DateTime max, string maxDateTimeErrorMessageFormat = null) => (column, value) => DateTimeValidator.CreateMaxDateTime(column, value, max, null, maxDateTimeErrorMessageFormat);
public void Validate_Range_AreEqual(string value, bool isValid) { DateTimeValidator validator = new DateTimeValidator("", value, new DateTime(1912, 3, 2), new DateTime(1912, 3, 4)); Assert.AreEqual(validator.Validate(), isValid); }