public void GetTaskCountTest()
        {
            // Get a test user and test company
            var testUser    = GetTestUser();
            var testCompany = GetTestCompany(testUser);

            TaskManagerService.TaskManagerService taskManagerService = new TaskManagerService.TaskManagerService(db, testCompany);

            // Now create a task and try to search for it
            int expected = taskManagerService.GetTaskCount();   // Start count

            for (int i = 0; i < 10; i++)
            {
                int rand = RandomInt(5, 20);
                for (int j = 0; j < rand; j++)
                {
                    var testTask = createTestTask(testCompany, testUser);
                    var error    = taskManagerService.InsertOrUpdateTask(testTask, "");
                    Assert.IsTrue(!error.IsError, error.Message);
                }
                expected += rand;

                int actual = taskManagerService.GetTaskCount();
                Assert.IsTrue(actual == expected, $"Error: {actual} items were found when {expected} were expected ");
            }
        }
Exemplo n.º 2
0
        public void SendMSQOverrideEMailTest()
        {
            var testUser     = GetTestUser();
            var testCompany  = GetTestCompany(testUser, true);
            var testCustomer = GetTestCustomer(testCompany, testUser);

            var soh = GetTestSalesOrderHeader(testCompany, testCustomer, testUser, RandomInt(5, 50));

            EMailService.EMailService             EMailService       = GetEMailService(testCompany);
            TaskManagerService.TaskManagerService TaskManagerService = GetTaskManagerService(testCompany);

            int emailQBefore        = EMailService.GetQueueCount(),
                notificationsBefore = TaskManagerService.GetTaskCount();

            var testUser2 = GetTestUser();
            var error     = SalesService.SendMSQOverrideEMail(testCompany, testUser, testUser2, soh);

            int emailQAfter        = EMailService.GetQueueCount(),
                notificationsAfter = TaskManagerService.GetTaskCount();

            int actual   = emailQAfter - emailQBefore,
                expected = 1;

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

            actual   = notificationsAfter - notificationsBefore;
            expected = 1;
            Assert.IsTrue(actual == expected, $"Error: {actual} Notifications were returned when {expected} were expected");
        }