public async void Type_Update_length() { Mock <IPostTypeRepository> postTypeRepository = new Mock <IPostTypeRepository>(); postTypeRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new PostType())); var validator = new ApiPostTypeRequestModelValidator(postTypeRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiPostTypeRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Type, new string('A', 51)); }
public async void Type_Create_null() { Mock <IPostTypeRepository> postTypeRepository = new Mock <IPostTypeRepository>(); postTypeRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new PostType())); var validator = new ApiPostTypeRequestModelValidator(postTypeRepository.Object); await validator.ValidateCreateAsync(new ApiPostTypeRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Type, null as string); }