public ResultViewModel AddNonconformity(AddNonconformityViewModel request)
        {
            Nonconformity    nonconformity    = new Nonconformity(request.Description);
            ValidationResult validationResult = nonconformity.isValid();

            if (!validationResult.IsValid)
            {
                return(new ResultViewModel(false, nonconformity.Id, validationResult.ToString()));
            }

            nonconformity = _nonconformityRepository.Add(nonconformity);
            nonconformity = UpdateCodeWhenAdd(nonconformity);

            var resultViewModel = new ResultViewModel(true, nonconformity.Id, "Nonconformity successfully saved!");

            return(resultViewModel);
        }
        public void NonconformityDescriptionGreaterThanMaxCaractersShouldFail(string description)
        {
            Nonconformity nonconformity = new Nonconformity(description);

            Assert.False(nonconformity.isValid().IsValid);
        }
        public void NonconformityDescriptionLessThanMaxCaractersShouldPass(string description)
        {
            Nonconformity nonconformity = new Nonconformity(description);

            Assert.True(nonconformity.isValid().IsValid);
        }