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