public async void OrganizationId_Create_Valid_Reference() { Mock <ITeamRepository> teamRepository = new Mock <ITeamRepository>(); teamRepository.Setup(x => x.OrganizationByOrganizationId(It.IsAny <int>())).Returns(Task.FromResult <Organization>(new Organization())); var validator = new ApiTeamServerRequestModelValidator(teamRepository.Object); await validator.ValidateCreateAsync(new ApiTeamServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.OrganizationId, 1); }
private async void BeUniqueByName_Update_Not_Exists() { Mock <ITeamRepository> teamRepository = new Mock <ITeamRepository>(); teamRepository.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult <Team>(null)); var validator = new ApiTeamServerRequestModelValidator(teamRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiTeamServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.Name, "A"); }