protected override ValidationResult IsValid(object value, ValidationContext context)
        {
            if (value == null)
            {
                return(new ValidationResult("empty repo name?"));
            }

            IRepositoryRepository RepositoryRepository = DependencyResolver.Current.GetService <IRepositoryRepository>();

            if (RepositoryRepository.NameIsUnique(value.ToString(), ((RepositoryDetailModel)context.ObjectInstance).Id))
            {
                return(ValidationResult.Success);
            }
            return(new ValidationResult(Resources.Validation_Duplicate_Name));
        }
Ejemplo n.º 2
0
 public void NewRepoNameIsUnique()
 {
     _repo.Create(MakeRepo("abc"));
     Assert.IsTrue(_repo.NameIsUnique("x", Guid.Empty));
 }