public async void Description_Create_length() { Mock <ISpaceRepository> spaceRepository = new Mock <ISpaceRepository>(); spaceRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Space())); var validator = new ApiSpaceRequestModelValidator(spaceRepository.Object); await validator.ValidateCreateAsync(new ApiSpaceRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Description, new string('A', 129)); }
public async void Name_Create_null() { Mock <ISpaceRepository> spaceRepository = new Mock <ISpaceRepository>(); spaceRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Space())); var validator = new ApiSpaceRequestModelValidator(spaceRepository.Object); await validator.ValidateCreateAsync(new ApiSpaceRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, null as string); }
public async void StudioId_Create_Valid_Reference() { Mock <ISpaceRepository> spaceRepository = new Mock <ISpaceRepository>(); spaceRepository.Setup(x => x.GetStudio(It.IsAny <int>())).Returns(Task.FromResult <Studio>(new Studio())); var validator = new ApiSpaceRequestModelValidator(spaceRepository.Object); await validator.ValidateCreateAsync(new ApiSpaceRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.StudioId, 1); }