public async void Name_Create_length() { Mock <IOrganizationRepository> organizationRepository = new Mock <IOrganizationRepository>(); organizationRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Organization())); var validator = new ApiOrganizationRequestModelValidator(organizationRepository.Object); await validator.ValidateCreateAsync(new ApiOrganizationRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129)); }
private async void BeUniqueByName_Create_Not_Exists() { Mock <IOrganizationRepository> organizationRepository = new Mock <IOrganizationRepository>(); organizationRepository.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult <Organization>(null)); var validator = new ApiOrganizationRequestModelValidator(organizationRepository.Object); await validator.ValidateCreateAsync(new ApiOrganizationRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.Name, "A"); }