private async void BeUniqueByExternalId_Update_Not_Exists() { Mock <IChainRepository> chainRepository = new Mock <IChainRepository>(); chainRepository.Setup(x => x.ByExternalId(It.IsAny <Guid>())).Returns(Task.FromResult <Chain>(null)); var validator = new ApiChainServerRequestModelValidator(chainRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiChainServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.ExternalId, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); }
public async void ChainStatusId_Update_Valid_Reference() { Mock <IChainRepository> chainRepository = new Mock <IChainRepository>(); chainRepository.Setup(x => x.ChainStatusByChainStatusId(It.IsAny <int>())).Returns(Task.FromResult <ChainStatus>(new ChainStatus())); var validator = new ApiChainServerRequestModelValidator(chainRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiChainServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.ChainStatusId, 1); }
public async void TeamId_Create_Valid_Reference() { Mock <IChainRepository> chainRepository = new Mock <IChainRepository>(); chainRepository.Setup(x => x.TeamByTeamId(It.IsAny <int>())).Returns(Task.FromResult <Team>(new Team())); var validator = new ApiChainServerRequestModelValidator(chainRepository.Object); await validator.ValidateCreateAsync(new ApiChainServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.TeamId, 1); }