コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
        }