public void Should_Success_Get_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME); var Response = facade.Read(); Assert.NotEqual(Response.Data.Count, 0); }
public async Task Should_Success_Get_Data() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider(GetCurrentMethod()).Object, dbContext); var dataUtil = await _dataUtil(facade, dbContext, GetCurrentMethod()).GetTestData(USERNAME); var Response = facade.Read(); Assert.NotEmpty(Response.Data); }
public IActionResult Get(int page = 1, int size = 25, string order = "{}", string keyword = null, string filter = "{}") { identityService.Username = User.Claims.Single(p => p.Type.Equals("username")).Value; filter = filter.Replace("{", string.Empty).Replace("}", string.Empty); if (!filter.Equals(string.Empty)) { filter += ", "; } filter = string.Concat(filter, "'CreatedBy':'", identityService.Username, "'"); filter = string.Concat("{", filter, "}"); var Data = _facade.Read(page, size, order, keyword, filter); var newData = _mapper.Map <List <UnitReceiptNoteViewModel> >(Data.Item1); List <object> listData = new List <object>(); listData.AddRange( newData.AsQueryable().Select(s => new { s._id, s.no, s.date, s.supplier, s.doNo, unit = new { division = new { s.unit.division.name }, s.unit.name }, s.items }).ToList() ); return(Ok(new { apiVersion = ApiVersion, statusCode = General.OK_STATUS_CODE, message = General.OK_MESSAGE, data = listData, info = new Dictionary <string, object> { { "count", listData.Count }, { "total", Data.Item2 }, { "order", Data.Item3 }, { "page", page }, { "size", size } }, })); }
public void Should_Success_Get_GetPurchaseRequestCategoryCode() { var dbContext = _dbContext(GetCurrentMethod()); UnitReceiptNoteFacade facade = new UnitReceiptNoteFacade(_ServiceProvider.Object, dbContext); var dataUtil = _dataUtil(facade, dbContext).GetTestData(USERNAME); var Response = facade.Read(); Assert.NotEqual(Response.Data.Count, 0); foreach (var data in Response.Data) { foreach (var item in data.Items) { var categoryCode = facade.GetPurchaseRequestCategoryCode(item.PRId); Assert.NotNull(categoryCode); } } }