public void Should_Success_Validate_All_Null_ObjectProperty() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var service = new MemoService(dbContext, serviceProviderMock.Object); var dataUtil = new MemoDataUtil(service); var viewModel = dataUtil.GetViewModelToValidate(); Assert.True(viewModel.Validate(null).Count() > 0); }
public async Task Should_Success_Create_Model_SalesInvoice() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var service = new MemoService(dbContext, serviceProviderMock.Object); var dataUtil = new MemoDataUtil(service); var modelToCreate = dataUtil.GetMemoModelToCreate_SalesInvoice(); var result = await service.CreateAsync(modelToCreate); Assert.NotEqual(0, result); }
public async Task Should_Success_Delete_ById_SalesInvoice() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var service = new MemoService(dbContext, serviceProviderMock.Object); var dataUtil = new MemoDataUtil(service); var data = await dataUtil.GetCreatedSalesInvoiceData(); var result = await service.DeleteAsync(data.Id); Assert.NotEqual(0, result); }
public async Task Should_Success_MapToViewModel_SalesInvoice() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var service = new MemoService(dbContext, serviceProviderMock.Object); var dataUtil = new MemoDataUtil(service); var data = await dataUtil.GetCreatedSalesInvoiceData(); var result = await service.ReadBySalesInvoiceAsync(data.SalesInvoiceNo); Assert.NotNull(result); }
public async Task Should_Success_Read_ById() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var service = new MemoService(dbContext, serviceProviderMock.Object); var dataUtil = new MemoDataUtil(service); var data = await dataUtil.GetCreatedData(); var result = await service.ReadByIdAsync(data.Id); Assert.NotNull(result); }
public async Task Should_Success_Read_Data_SalesInvoice() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var service = new MemoService(dbContext, serviceProviderMock.Object); var dataUtil = new MemoDataUtil(service); await dataUtil.GetCreatedSalesInvoiceData(); var result = service.Read(1, 10, "{}", new List <string>(), "", "{}"); Assert.NotEmpty(result.Data); }
public async Task Should_Success_MapToViewModel() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var service = new MemoService(dbContext, serviceProviderMock.Object); var dataUtil = new MemoDataUtil(service); var data = await dataUtil.GetCreatedData(); var result = await service.ReadByIdAsync(data.Id); Mapper.Initialize(mapper => mapper.AddProfile <MemoProfile>()); Mapper.AssertConfigurationIsValid(); var viewModel = Mapper.Map <MemoViewModel>(result); Assert.NotNull(viewModel); var model = Mapper.Map <MemoModel>(viewModel); Assert.NotNull(model); }
public async Task Should_Success_Update_Model_SalesInvoice() { var dbContext = GetDbContext(GetCurrentMethod()); var serviceProviderMock = GetServiceProviderMock(); var service = new MemoService(dbContext, serviceProviderMock.Object); var dataUtil = new MemoDataUtil(service); var modelToUpdate = await dataUtil.GetCreatedSalesInvoiceData(); modelToUpdate.Items.Add(new MemoItemModel() { CurrencyCode = "CurrencyCode", CurrencyId = 1, CurrencyRate = 1, Interest = 1, PaymentAmount = 1 }); var result = await service.UpdateAsync(modelToUpdate.Id, modelToUpdate); Assert.NotEqual(0, result); }