Exemple #1
0
        public void TestNewOrChangePrefix(string right_answer, string week_start, string week_end, string report_file_path)
        {
            if (File.Exists(report_file_path))
            {
                BaseController.EnsureGlobalData(); // Report constructor requires GlobalHistoryTable
                var range  = new Scout2.WeeklyReport.WeeklyReport.DateRange(week_start, week_end);
                var report = new BillReport(report_file_path);
                var answer = BillUtils.NewOrChangePrefix(range, report);
                switch (right_answer)
                {
                case "New":
                    Assert.True(answer.Contains("NEW"), $"TestNewOrChangePrefix: {answer} is not correct, should contain NEW.");
                    break;

                case "Update":
                    Assert.True(answer.Contains("UPDATED"), $"TestNewOrChangePrefix: {answer} is not correct, should contain UPDATED.");
                    break;

                case "None":
                    Assert.True(answer.Length == 0, $"TestNewOrChangePrefix: {answer} is not correct, should be of 0 length.");
                    break;

                default:
                    Assert.True(false, $"TestNewOrChangePrefix: {answer} is not a valid NewOrChangePrefix response.");
                    break;
                }
            }
            else
            {
                Assert.True(false, $"TestNewOrChangePrefix: {report_file_path} does not exist.");
            }
        }
Exemple #2
0
        public void TestIsNewThisWeek(int new_week, string report_date, string week_start, string week_end)
        {
            string report_contents = $"   <b>Summary</b>: (Reviewed {report_date})";
            var    range           = new Scout2.WeeklyReport.WeeklyReport.DateRange(week_start, week_end);
            bool   is_new_week     = new_week != 0;
            bool   test            = is_new_week == BillUtils.IsNewThisWeek(report_contents, range);

            Assert.True(is_new_week == BillUtils.IsNewThisWeek(report_contents, range));
        }