public async void UserDisplayName_Create_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.ValidateCreateAsync(new ApiPostHistoryServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.UserDisplayName, new string('A', 41)); }
public async void PostId_Create_Valid_Reference() { Mock <IPostHistoryRepository> postHistoryRepository = new Mock <IPostHistoryRepository>(); postHistoryRepository.Setup(x => x.PostByPostId(It.IsAny <int>())).Returns(Task.FromResult <Post>(new Post())); var validator = new ApiPostHistoryServerRequestModelValidator(postHistoryRepository.Object); await validator.ValidateCreateAsync(new ApiPostHistoryServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.PostId, 1); }
public async void RevisionGUID_Create_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.ValidateCreateAsync(new ApiPostHistoryServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.RevisionGUID, null as string); }