示例#1
0
        public async Task Should_Success_Delete_ById()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new DownPaymentService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new DownPaymentDataUtil(service);
            var data = await dataUtil.GetTestDataById();

            var result = await service.DeleteAsync(data.Id);

            Assert.NotEqual(0, result);
        }
示例#2
0
        public async Task Should_Success_Read_Data()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new DownPaymentService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new DownPaymentDataUtil(service);
            await dataUtil.GetTestDataById();

            var result = service.Read(1, 10, "{}", new List <string>(), "", "{}");

            Assert.NotEmpty(result.Data);
        }
示例#3
0
        public async Task Should_Success_Update_Model_Remove_Items()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new DownPaymentService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new DownPaymentDataUtil(service);
            var modelToUpdate       = await dataUtil.GetTestDataById();

            var result = await service.UpdateAsync(modelToUpdate.Id, modelToUpdate);

            Assert.NotEqual(0, result);
        }
示例#4
0
        public async Task Should_Success_Create_Same_Buyer()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new DownPaymentService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new DownPaymentDataUtil(service);
            await dataUtil.GetTestDataById();

            var modelToCreate = dataUtil.GetNewData();
            var result        = await service.CreateAsync(modelToCreate);

            Assert.NotEqual(0, result);
        }
示例#5
0
        public async Task Should_Success_MapToViewModel()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var service             = new DownPaymentService(dbContext, serviceProviderMock.Object);
            var dataUtil            = new DownPaymentDataUtil(service);
            var data = await dataUtil.GetTestDataById();

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

            //Mapper.Initialize(mapper => mapper.AddProfile<DownPaymentProfile>());
            //Mapper.AssertConfigurationIsValid();
            //var viewModel = Mapper.Map<DownPaymentViewModel>(result);
            //Assert.NotNull(viewModel);
            //var model = Mapper.Map<DownPaymentModel>(viewModel);
            Assert.NotNull(result);
        }