Пример #1
0
        public void TestConstructor()
        {
            var instance = new SuccessfulValidationResult();

            Assert.IsTrue(instance.IsValid);
            Assert.AreEqual(0, instance.Errors.Count());
        }
        private string GetSevisValidationResultAsJson(ValidationResult result)
        {
            SimpleValidationResult simpleValidationResult = null;

            if (result.IsValid)
            {
                simpleValidationResult = new SuccessfulValidationResult();
            }
            else
            {
                simpleValidationResult = new SimpleValidationResult(result);
            }
            return(JsonConvert.SerializeObject(
                       simpleValidationResult,
                       new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }));
        }