public void validateIntValidButNegative3() { _validatorService = new ValidatorService(); //Zero is not positive Assert.False(_validatorService.validateInt("0", true)); }
public void validateIntValidButNegative1() { _validatorService = new ValidatorService(); //-1 is valid if not required Assert.True(_validatorService.validateInt("-1", false)); }
public void InValidTest1() { ValidatorService s = new ValidatorService(); var result = s.JsonValidator(Config.INVALID_TEST1); Assert.AreEqual(Tuple.Create(false, "} has no opening"), result); }
public static void Main(string[] args) { Console.WriteLine("Hello World!"); var data = new[] { new TypeA { FirstName = "Taipan", LastName = "Prasithpongchai", Amount = 2 }, new TypeA { FirstName = "BBB", LastName = "CCC", Amount = 7 } }; var validateResult = ValidatorService <TypeA> .WithEnumerable(data) .ColumnOrder(e => e.FirstName) .FollowBy(e => e.LastName) .ValidateMaxLength(e => e.FirstName, 5) .ValidateMaxLength(e => e.LastName, 8) .CustomValidator(e => e.FirstName, f => f.StartsWith("T")) .CustomValidator(e => e.Amount, f => f > 5) .Validate(); Console.WriteLine(validateResult.ToString()); }
public static ListWrapper Run( [QueueTrigger("defaultListQueue")] ListWrapper listWrapper, TraceWriter log) { log.Info($"Validating data"); var validatorService = new ValidatorService(); var response = new ListWrapper { Elements = new List <string>() }; foreach (var element in listWrapper.Elements) { var isValidElement = validatorService.ValidateElement(element); if (isValidElement) { response.Elements.Add(element); } } log.Info($"Data validator function completed"); return(response); }
private async Task <int> OnExecuteAsync(CommandLineApplication app, IConsole console) { console.WriteLine(); console.WriteLine("Smart Contract Deployer"); console.WriteLine(); ContractCompilationResult result = CompilationLoader.CompileFromFileOrDirectoryName(this.InputFile, console); // Check if the file was found. if (result == null) { return(1); } ValidationServiceResult validationResult = ValidatorService.Validate(this.InputFile, result, console, this.Params); if (!validationResult.Success) { return(1); } else { console.WriteLine("Validation passed!"); } await DeployAsync(validationResult.CompilationResult.Compilation, console); console.WriteLine(); return(1); }
public void IsAdultTest() { IPerson person; IValidatorService validator = new ValidatorService(); IValidationResult result = new ValidationResult(); person = CreateTestPerson(result, validator, Data.ValidFName, Data.ValidLName, Data.ValidEmailId, Data.AdultDOB); Assert.IsTrue(person.IsAdult); person = CreateTestPerson(result, validator, Data.ValidFName, Data.ValidLName, Data.ValidEmailId, Data.AdultDOB.AddMonths(1)); Assert.IsFalse(person.IsAdult); person = CreateTestPerson(result, validator, Data.ValidFName, Data.ValidLName, Data.ValidEmailId, Data.AdultDOB.AddDays(1)); Assert.IsFalse(person.IsAdult); person = CreateTestPerson(result, validator, Data.ValidFName, Data.ValidLName, Data.ValidEmailId, Data.AdultDOB.AddMonths(-1)); Assert.IsTrue(person.IsAdult); try { person = CreateTestPerson(result, validator, Data.ValidFName, Data.ValidLName, Data.ValidEmailId); Assert.IsFalse(person.IsAdult); Assert.Fail(); } catch (Exception e) { Assert.IsInstanceOfType(e, typeof(ArgumentNullException)); } }
public void validateIntValidButNegative2() { _validatorService = new ValidatorService(); //Negative 1 is not positive Assert.False(_validatorService.validateInt("-1", true)); }
static void Main(string[] args) { ValidatorService validatorService = new ValidatorService(); FiltrService filtrService = new FiltrService(); CitiesController citiesController = new CitiesController(validatorService, filtrService); FiltrData data = new FiltrData { Cities = new City[] { new City { Budget = 1000, Name = "Moscow", Point = new Point { X = 1, Y = 1 } }, new City { Budget = 700, Name = "Piter", Point = new Point { X = 1, Y = 2 } }, new City { Budget = 300, Name = "Tver", Point = new Point { X = 2, Y = 1 } } }, Options = new FiltrOptions { Iterations = 12, PercentBet = 0.06 } }; citiesController.FiltrData(data); }
public Tuple <bool, string> JsonValidator(JsonInputDto input) { ValidatorService s = new ValidatorService(); var output = s.JsonValidator(input.JsonData); return(Tuple.Create(output.Item1, output.Item2)); }
public string validate(CAEXDocument doc, string path) { // start validating aml string validation_result = ""; ValidatorService service = ValidatorService.Register(); var enumerator = service.ValidateAll(doc).GetEnumerator(); while (enumerator.MoveNext()) { validation_result += print_Error(enumerator.Current) + "//"; } ValidatorService.UnRegister(); // no Errors in mistake if (enumerator.Current == null) { println("No errors found", ConsoleColor.Green); return("No errors found"); } return(validation_result); }
public void ValidTest3() { ValidatorService s = new ValidatorService(); var result = s.JsonValidator(Config.VALID_TEST3); //Assertion Assert.AreEqual(Tuple.Create(true, "Json is Valid"), result); }
public void Validation_Method_When_Everything_is_Correct() { var request = _fix.Build <Company>().With(x => x.Isin, "BR123").Create(); var validator = new ValidatorService(); var result = validator.Validate(request, _mock); result.Should().BeTrue(); }
public void InValidTest3() { ValidatorService s = new ValidatorService(); var result = s.JsonValidator(Config.INVALID_TEST3); // Assert.AreEqual(Tuple.Create(false, "] is a closing without a proper opening"), result); }
public void Initialize() { var scoreCardService = new ScoreCardService(); var scoreCalcService = new ScoreCalcService(); var validatorService = new ValidatorService(); _game = new Game(scoreCardService, scoreCalcService, validatorService); }
public void validateStatusValid() { _validatorService = new ValidatorService(); foreach (string test in STATUS_SUCCESS_LIST) { Assert.True(_validatorService.validateStatus(test)); } }
public void Validation_Method_When_Isis_Not_Valid() { var request = _fix.Build <Company>().With(x => x.Isin, "123").Create(); var validator = new ValidatorService(); var result = validator.Validate(request, _mock); result.Should().BeFalse(); }
public void validateStatusInvalid() { _validatorService = new ValidatorService(); foreach (string test in STATUS_FAIL_LIST) { Assert.False(_validatorService.validateStatus(test)); } }
public void validateIntInvalidIntTest() { _validatorService = new ValidatorService(); foreach (string test in INT_FAIL_LIST) { Assert.False(_validatorService.validateInt(test, false)); } }
public void validateIntSuccessTest() { _validatorService = new ValidatorService(); foreach (string test in INT_SUCCESS_LIST) { Assert.True(_validatorService.validateInt(test, true)); } }
/// <summary> /// Instantiates a ColleyMatrix client object; creates an n by n sparse matrix, where n is the number of teams in the defined league /// </summary> /// <param name="numberOfTeams">Number of teams in the league</param> public ColleyMatrix(int numberOfTeams) { _numberOfTeams = numberOfTeams; IJsonSerializationProvider jsonSerializationProvider = new JsonSerializationProvider(); IMatrixProvider matrixProvider = new MatrixProvider(jsonSerializationProvider, numberOfTeams); IValidatorService validatorService = new ValidatorService(matrixProvider); _colleyMatrixService = new ColleyMatrixService(matrixProvider, validatorService); }
public void IsValid_GivenShortString_ReturnsFalse() { var validator = new ValidatorService(); var password = "******"; var isValid = validator.IsValid(password); Assert.False(isValid); }
public void IsValid_GivenValidString_ReturnsTrue() { var validator = new ValidatorService(); var password = "******"; var isValid = validator.IsValid(password); Assert.True(isValid); }
public void IsValid_GivenValidLengthAllLowerCaseString_ReturnsFalse() { var validator = new ValidatorService(); var password = "******"; var isValid = validator.IsValid(password); Assert.False(isValid); }
public void IsValid_GivenLongString_ReturnsFalse() { var validator = new ValidatorService(); var password = "******"; var isValid = validator.IsValid(password); Assert.False(isValid); }
public void Validation_Method_When_ObrigatoryField_Is_Null() { var request = _fix.Build <Company>().With(x => x.Isin, "BR123").Create(); request.Name = ""; var validator = new ValidatorService(); var result = validator.Validate(request, _mock); result.Should().BeFalse(); }
public void validatestringOfCorrectLength() { _validatorService = new ValidatorService(); // strings with valid data and under max length are valid foreach (string test in STRING_VALID_LIST) { Assert.True(_validatorService.validateString(test, test.Length, false)); } }
public void validatestringOfIncorrectLength() { _validatorService = new ValidatorService(); // strings with valid data and over the max length are invalid foreach (string test in STRING_VALID_LIST) { Assert.False(_validatorService.validateString(test, test.Length - 1, false)); } }
public void validatestringEmptyAndRequired() { _validatorService = new ValidatorService(); // strings with null or empty values and are required are invalid foreach (string test in STRING_EMPTY_LIST) { Assert.False(_validatorService.validateString(test, 1, true)); } }
public void Validation_Method_When_Isin_Is_AlreadyTaken() { var request = _fix.Build <Company>().With(x => x.Isin, "BR123").Create(); _mock.GetByIsin(request.Isin).Returns(request); var validator = new ValidatorService(); var result = validator.Validate(request, _mock); result.Should().BeFalse(); }