Example #1
0
        public async void Name_Update_length()
        {
            Mock <IEventStatusRepository> eventStatusRepository = new Mock <IEventStatusRepository>();

            eventStatusRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new EventStatus()));

            var validator = new ApiEventStatusServerRequestModelValidator(eventStatusRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiEventStatusServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129));
        }
Example #2
0
        public async void Name_Create_null()
        {
            Mock <IEventStatusRepository> eventStatusRepository = new Mock <IEventStatusRepository>();

            eventStatusRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new EventStatus()));

            var validator = new ApiEventStatusServerRequestModelValidator(eventStatusRepository.Object);
            await validator.ValidateCreateAsync(new ApiEventStatusServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, null as string);
        }