public void ExpenseCzar_Should_Generate()
        {
            int staffid = BusinessUser.Current == null ? -1 : Convert.ToInt32(BusinessUser.Current.UserKey);
            staffid = BusinessUser.Current == null ? -1 : Convert.ToInt32(BusinessUser.Current.UserKey);

            //var isolation = IsolationLevel.ReadUncommitted;

            using (var transaction = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(1, 1, 1)))
            {
                var generationDao = DataAccessFactory.Create<GenericDao>();
                TestDao testDao = new TestDao(generationDao);

                int queueId = new ReportGenerationQueueBuilder()
                    .WithGenerationDao(DataAccessFactory.CreateWithSameContext<GenerationDao>(generationDao))
                    .WithPeriod(201101)
                    .WithReforecastQuarterName("Q0")
                    .WithReportId(testDao.GetReportIdByName("Andre's Unit Test01"))
                    .Build();

                AbstractReportGenerator reportGenerator = ReportGeneratorFactory.GetReportGenerator(queueId);

                Assert.AreEqual(reportGenerator.GetType(), typeof(ExpenseCzarReportGenerator), "expected the report to use the expense czar generator");

                reportGenerator.GenerateReport();

                transaction.Dispose();
            }
        }
예제 #2
0
        public void Should_Generate_Profitibility()
        {
            using (var transaction = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(1, 1, 1)))
            {
                var generationDao = DataAccessFactory.Create<GenericDao>();
                TestDao testDao = new TestDao(generationDao);

                int queueId = new ReportGenerationQueueBuilder()
                    .WithGenerationDao(DataAccessFactory.CreateWithSameContext<GenerationDao>(generationDao))
                    .WithPeriod(201101)
                    .WithReforecastQuarterName("Q2")
                    .WithReportId(testDao.GetReportIdByName("Andre's Profitability UnitTest01"))
                    .Build();

                AbstractReportGenerator reportGenerator = ReportGeneratorFactory.GetReportGenerator(queueId);

                Assert.AreEqual(reportGenerator.GetType(), typeof(ProfitabilityReportGenerator), "expected the report to use the expense czar generator");

                reportGenerator.GenerateReport();

                transaction.Dispose();
            }
        }