예제 #1
0
        public async void Validate_ViewModel_Duplicate()
        {
            var serviceProvider = GetServiceProvider();

            var service = new BankCashReceiptTypeService(serviceProvider.Object, _dbContext(GetCurrentMethod()));

            serviceProvider.Setup(s => s.GetService(typeof(IBankCashReceiptTypeService)))
            .Returns(service);

            var data = await _dataUtil(service).GetTestData();

            var viewModel = new BankCashReceiptTypeViewModel
            {
                COACode = data.COACode,
                Name    = data.Name,
                COAName = data.COAName,
                COAId   = data.COAId
            };

            var validationContext = new ValidationContext(viewModel, serviceProvider.Object, null);

            var result = viewModel.Validate(validationContext);

            Assert.NotEmpty(result.ToList());
        }
예제 #2
0
        public void Validate_ViewModel()
        {
            var serviceProvider = GetServiceProvider();

            var viewModel         = new BankCashReceiptTypeViewModel();
            var validationContext = new ValidationContext(viewModel, serviceProvider.Object, null);

            var result = viewModel.Validate(validationContext);

            Assert.NotEmpty(result.ToList());
        }