コード例 #1
0
        public void InsertOrUpdateCreditClaimHeaderTest()
        {
            var testUser    = GetTestUser();
            var testCompany = GetTestCompany(testUser);

            // Check db before test
            SalesService.CleanCreditClaimTables();
            CreditClaimHeaderListModel cch = SalesService.FindCreditClaimHeaders();

            int expected = 0;
            int actual   = cch.Items.Count();

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

            // Create and test
            var model = getCreditClaimHeader();

            cch = SalesService.FindCreditClaimHeaders();

            expected = 1;
            actual   = cch.Items.Count();
            Assert.IsTrue(expected == actual, $"Error: {actual} number of items were found when {expected} were expected");
            AreEqual(model, cch.Items);

            // Delete and check after test
            SalesService.CleanCreditClaimTables();
            cch = SalesService.FindCreditClaimHeaders();

            expected = 0;
            actual   = cch.Items.Count();
            Assert.IsTrue(expected == actual, $"Error: {actual} number of items were found when {expected} were expected");
        }
コード例 #2
0
        public CreditClaimHeaderListModel FindCreditClaimHeaders()
        {
            CreditClaimHeaderListModel model = new CreditClaimHeaderListModel();

            foreach (var cch in db.FindCreditClaimHeaders())
            {
                model.Items.Add(MapToModel(cch));
            }
            return(model);
        }