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)); }
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)); }
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); }