コード例 #1
0
        public async void Name_Update_length()
        {
            Mock <ICallStatusRepository> callStatusRepository = new Mock <ICallStatusRepository>();

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

            var validator = new ApiCallStatusServerRequestModelValidator(callStatusRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiCallStatusServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129));
        }
コード例 #2
0
        public async void Name_Create_null()
        {
            Mock <ICallStatusRepository> callStatusRepository = new Mock <ICallStatusRepository>();

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

            var validator = new ApiCallStatusServerRequestModelValidator(callStatusRepository.Object);
            await validator.ValidateCreateAsync(new ApiCallStatusServerRequestModel());

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