public async void Log_Update_null() { Mock <ILinkLogRepository> linkLogRepository = new Mock <ILinkLogRepository>(); linkLogRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new LinkLog())); var validator = new ApiLinkLogServerRequestModelValidator(linkLogRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiLinkLogServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Log, null as string); }
public async void LinkId_Update_Valid_Reference() { Mock <ILinkLogRepository> linkLogRepository = new Mock <ILinkLogRepository>(); linkLogRepository.Setup(x => x.LinkByLinkId(It.IsAny <int>())).Returns(Task.FromResult <Link>(new Link())); var validator = new ApiLinkLogServerRequestModelValidator(linkLogRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiLinkLogServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.LinkId, 1); }