예제 #1
0
        public async void ReasonType_Update_null()
        {
            Mock <ISalesReasonRepository> salesReasonRepository = new Mock <ISalesReasonRepository>();

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

            var validator = new ApiSalesReasonRequestModelValidator(salesReasonRepository.Object);
            await validator.ValidateUpdateAsync(default(int), new ApiSalesReasonRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.ReasonType, null as string);
        }
예제 #2
0
        public async void Name_Create_length()
        {
            Mock <ISalesReasonRepository> salesReasonRepository = new Mock <ISalesReasonRepository>();

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

            var validator = new ApiSalesReasonRequestModelValidator(salesReasonRepository.Object);
            await validator.ValidateCreateAsync(new ApiSalesReasonRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 51));
        }