Esempio n. 1
0
        public async void Name_Update_length()
        {
            Mock <ICallTypeRepository> callTypeRepository = new Mock <ICallTypeRepository>();

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

            var validator = new ApiCallTypeServerRequestModelValidator(callTypeRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiCallTypeServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129));
        }
Esempio n. 2
0
        public async void Name_Create_null()
        {
            Mock <ICallTypeRepository> callTypeRepository = new Mock <ICallTypeRepository>();

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

            var validator = new ApiCallTypeServerRequestModelValidator(callTypeRepository.Object);
            await validator.ValidateCreateAsync(new ApiCallTypeServerRequestModel());

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