Exemplo n.º 1
0
        public void FindPurchaseOrderHeaderSummaryListModelTest()
        {
            var testUser    = GetTestUser();
            var testCompany = GetTestCompany(testUser, true);

            // Create a random number of purchases
            List <PurchaseOrderHeaderModel> pohList = new List <PurchaseOrderHeaderModel>();
            int numPohs = RandomInt(5, 25);

            for (int i = 0; i < numPohs; i++)
            {
                pohList.Add(GetTestPurchaseOrderHeader(testCompany, testUser, 10));
            }

            // Check that they are found
            var result   = PurchasingService.FindPurchaseOrderHeaderSummaryListModel(testCompany, testUser, 0, 1, PageSize, "");
            int actual   = result.Items.Count;
            int expected = numPohs;

            Assert.IsTrue(actual == expected, $"Error: {actual} items were returned when {expected} were expected");

            // Now delete them
            foreach (var poh in pohList)
            {
                PurchasingService.DeletePurchaseOrderHeader(poh);
            }

            // Now check that they have disappeared
            result   = PurchasingService.FindPurchaseOrderHeadersListModel(testCompany.Id, 0, 1, PageSize, "", 0, 0, 0);
            actual   = result.Items.Count;
            expected = 0;
            Assert.IsTrue(actual == expected, $"Error: {actual} items were returned when {expected} were expected");
        }
Exemplo n.º 2
0
 public ActionResult GetPurchaseSummary(int index, int pageNo, int pageSize, string search)
 {
     return(Json(PurchasingService.FindPurchaseOrderHeaderSummaryListModel(CurrentCompany, CurrentUser, index, pageNo, pageSize, search), JsonRequestBehavior.AllowGet));
 }