public async void Description_Update_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.ValidateUpdateAsync(default(int), new ApiSpaceRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Description, new string('A', 129));
        }
        public async void Name_Update_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.ValidateUpdateAsync(default(int), new ApiSpaceRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, null as string);
        }
示例#3
0
        public async void StudioId_Create_Invalid_Reference()
        {
            Mock <ISpaceRepository> spaceRepository = new Mock <ISpaceRepository>();

            spaceRepository.Setup(x => x.GetStudio(It.IsAny <int>())).Returns(Task.FromResult <Studio>(null));

            var validator = new ApiSpaceRequestModelValidator(spaceRepository.Object);

            await validator.ValidateCreateAsync(new ApiSpaceRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.StudioId, 1);
        }