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 ApiPostHistoryServerRequestModelValidator(postHistoryRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiPostHistoryServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.UserDisplayName, new string('A', 41)); }
public async void PostHistoryTypeId_Update_Valid_Reference() { Mock <IPostHistoryRepository> postHistoryRepository = new Mock <IPostHistoryRepository>(); postHistoryRepository.Setup(x => x.PostHistoryTypeByPostHistoryTypeId(It.IsAny <int>())).Returns(Task.FromResult <PostHistoryType>(new PostHistoryType())); var validator = new ApiPostHistoryServerRequestModelValidator(postHistoryRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiPostHistoryServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.PostHistoryTypeId, 1); }
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 ApiPostHistoryServerRequestModelValidator(postHistoryRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiPostHistoryServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.RevisionGUID, null as string); }