public async void PreviousChainId_Create_Valid_Reference() { Mock <IClaspRepository> claspRepository = new Mock <IClaspRepository>(); claspRepository.Setup(x => x.ChainByPreviousChainId(It.IsAny <int>())).Returns(Task.FromResult <Chain>(new Chain())); var validator = new ApiClaspServerRequestModelValidator(claspRepository.Object); await validator.ValidateCreateAsync(new ApiClaspServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.PreviousChainId, 1); }
public async void NextChainId_Update_Invalid_Reference() { Mock <IClaspRepository> claspRepository = new Mock <IClaspRepository>(); claspRepository.Setup(x => x.ChainByNextChainId(It.IsAny <int>())).Returns(Task.FromResult <Chain>(null)); var validator = new ApiClaspServerRequestModelValidator(claspRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiClaspServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.NextChainId, 1); }