Esempio n. 1
0
        public async void RevisionGUID_Create_length()
        {
            Mock <IPostHistoryRepository> postHistoryRepository = new Mock <IPostHistoryRepository>();

            postHistoryRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new PostHistory()));

            var validator = new ApiPostHistoryRequestModelValidator(postHistoryRepository.Object);
            await validator.ValidateCreateAsync(new ApiPostHistoryRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.RevisionGUID, new string('A', 37));
        }
Esempio n. 2
0
        public async void UserDisplayName_Update_length()
        {
            Mock <IPostHistoryRepository> postHistoryRepository = new Mock <IPostHistoryRepository>();

            postHistoryRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new PostHistory()));

            var validator = new ApiPostHistoryRequestModelValidator(postHistoryRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiPostHistoryRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.UserDisplayName, new string('A', 41));
        }
Esempio n. 3
0
        public async void RevisionGUID_Update_null()
        {
            Mock <IPostHistoryRepository> postHistoryRepository = new Mock <IPostHistoryRepository>();

            postHistoryRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new PostHistory()));

            var validator = new ApiPostHistoryRequestModelValidator(postHistoryRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiPostHistoryRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.RevisionGUID, null as string);
        }