public async void Description_Update_length() { Mock <IVideoRepository> videoRepository = new Mock <IVideoRepository>(); videoRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Video())); var validator = new ApiVideoServerRequestModelValidator(videoRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiVideoServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Description, new string('A', 4001)); }
public async void Title_Update_null() { Mock <IVideoRepository> videoRepository = new Mock <IVideoRepository>(); videoRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Video())); var validator = new ApiVideoServerRequestModelValidator(videoRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiVideoServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Title, null as string); }
public async void Url_Create_length() { Mock <IVideoRepository> videoRepository = new Mock <IVideoRepository>(); videoRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Video())); var validator = new ApiVideoServerRequestModelValidator(videoRepository.Object); await validator.ValidateCreateAsync(new ApiVideoServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Url, new string('A', 129)); }