Example #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());
        }
Example #2
0
        public async void Should_Success_Get_Data_By_Id()
        {
            var service = new BankCashReceiptTypeService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data    = await _dataUtil(service).GetTestData();

            var Response = await service.ReadByIdAsync(data.Id);

            Assert.NotNull(Response);
        }
Example #3
0
        public async void Should_Success_Get_Data()
        {
            var service = new BankCashReceiptTypeService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data    = await _dataUtil(service).GetTestData();

            var Response = service.Read(1, 25, "{}", null, data.Name, "{}");

            Assert.NotEmpty(Response.Data);
        }
Example #4
0
        public async void Should_Success_Create_Data()
        {
            var service = new BankCashReceiptTypeService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data    = _dataUtil(service).GetNewData();

            var Response = await service.CreateAsync(data);

            Assert.NotEqual(0, Response);
        }
Example #5
0
 public BankCashReceiptTypeDataUtil(BankCashReceiptTypeService service)
 {
     Service = service;
 }
Example #6
0
 private BankCashReceiptTypeDataUtil _dataUtil(BankCashReceiptTypeService service)
 {
     return(new BankCashReceiptTypeDataUtil(service));
 }