Example #1
0
        public void ShouldListAllStatuses()
        {
            ExpenseReportStatus[] statuses = ExpenseReportStatus.GetAllItems();

            Assert.That(statuses.Length, Is.EqualTo(3));
            Assert.That(statuses[0], Is.EqualTo(ExpenseReportStatus.Draft));
            Assert.That(statuses[1], Is.EqualTo(ExpenseReportStatus.Submitted));
            Assert.That(statuses[2], Is.EqualTo(ExpenseReportStatus.Approved));
        }
Example #2
0
        public static IEnumerable <SelectListItem> GetOptions(string selected)
        {
            var result = new List <SelectListItem>();

            foreach (var status in ExpenseReportStatus.GetAllItems())
            {
                result.Add(new SelectListItem
                {
                    Text     = status.FriendlyName,
                    Value    = status.Key,
                    Selected = (status.Key == selected)
                });
            }

            return(result);
        }
Example #3
0
        public void PopulateDatabase()
        {
            new DatabaseTester().Clean();
            ISession session = DataContext.GetTransactedSession();


            //Trainer1
            var jpalermo = new Employee("jpalermo", "Jeffrey", "Palermo", "*****@*****.**");

            session.SaveOrUpdate(jpalermo);

            //Person 1

            //Person 2

            //Person 3
            var damian = new Employee("damian", "Damian", "Brady", "*****@*****.**");

            session.SaveOrUpdate(damian);

            //Person 4

            //Person 5

            //Person 6
            var paul = new Employee("paul", "Paul", "Stovell", "*****@*****.**");

            session.SaveOrUpdate(paul);

            //Person 7

            //Person 8

            //Person 9

            //Person 10

            //Person 11

            //Person 12

            //Person 13

            var hsimpson = new Employee("hsimpson", "Homer", "Simpson", "*****@*****.**");

            session.SaveOrUpdate(hsimpson);

            foreach (ExpenseReportStatus status in ExpenseReportStatus.GetAllItems())
            {
                var report = new ExpenseReport();
                report.Number      = Guid.NewGuid().ToString().Substring(0, 5).ToUpper();
                report.Submitter   = jpalermo;
                report.Approver    = jpalermo;
                report.Status      = status;
                report.Title       = "Expense report starting in status " + status;
                report.Description = "Foo, foo, foo, foo " + status;
                new DateTime(2000, 1, 1, 8, 0, 0);
                report.ChangeStatus(ExpenseReportStatus.Draft);
                report.ChangeStatus(ExpenseReportStatus.Submitted);
                report.ChangeStatus(ExpenseReportStatus.Approved);

                session.SaveOrUpdate(report);
            }

            var order2 = new ExpenseReport();

            order2.Number      = Guid.NewGuid().ToString().Substring(0, 5).ToUpper();
            order2.Submitter   = jpalermo;
            order2.Approver    = jpalermo;
            order2.Status      = ExpenseReportStatus.Approved;
            order2.Title       = "Expense report starting in status ";
            order2.Description = "Foo, foo, foo, foo ";
            new DateTime(2000, 1, 1, 8, 0, 0);
            session.SaveOrUpdate(order2);

            session.Transaction.Commit();
            session.Dispose();
        }
Example #4
0
        public void PopulateDatabase()
        {
            new DatabaseTester().Clean();
            ISession session = DataContext.GetTransactedSession();

            var lead        = new Role("Facility Lead");
            var fulfillment = new Role("Fulfillment");

            session.SaveOrUpdate(lead);
            session.SaveOrUpdate(fulfillment);

            //Trainer1
            var jpalermo = new Employee("jpalermo", "Jeffrey", "Palermo", "*****@*****.**");

            jpalermo.AddRole(lead);
            jpalermo.AddRole(fulfillment);
            session.SaveOrUpdate(jpalermo);

            //Person 1

            //Person 2

            //Person 3

            //Person 4

            //Person 5

            //Person 6

            //Person 7

            //Person 8

            //Person 9

            //Person 10

            //Person 11

            //Person 12

            //Person 13

            var hsimpson = new Employee("hsimpson", "Homer", "Simpson", "*****@*****.**");

            hsimpson.AddRole(fulfillment);
            session.SaveOrUpdate(hsimpson);

            foreach (ExpenseReportStatus status in ExpenseReportStatus.GetAllItems())
            {
                var order = new ExpenseReport();
                order.Number      = Guid.NewGuid().ToString().Substring(0, 5).ToUpper();
                order.Submitter   = jpalermo;
                order.Approver    = jpalermo;
                order.Status      = status;
                order.Title       = "Work Order starting in status " + status;
                order.Description = "Foo, foo, foo, foo " + status;
                order.CreatedDate = new DateTime(2000, 1, 1, 8, 0, 0);
                new DateTime(2000, 1, 1, 8, 0, 0);
                order.ChangeStatus(ExpenseReportStatus.Draft);
                order.ChangeStatus(ExpenseReportStatus.Submitted);
                order.ChangeStatus(ExpenseReportStatus.Approved);

                session.SaveOrUpdate(order);
            }

            var order2 = new ExpenseReport();

            order2.Number      = Guid.NewGuid().ToString().Substring(0, 5).ToUpper();
            order2.Submitter   = jpalermo;
            order2.Approver    = jpalermo;
            order2.Status      = ExpenseReportStatus.Approved;
            order2.Title       = "Work Order starting in status ";
            order2.Description = "Foo, foo, foo, foo ";
            order2.CreatedDate = new DateTime(2000, 1, 1, 8, 0, 0);
            new DateTime(2000, 1, 1, 8, 0, 0);
            session.SaveOrUpdate(order2);

            session.Transaction.Commit();
            session.Dispose();
        }
Example #5
0
        public void PopulateDatabase()
        {
            new DatabaseTester().Clean();
            ISession session = DataContext.GetTransactedSession();


            //Trainer1
            var jpalermo = new Employee("jpalermo", "Jeffrey", "Palermo", "*****@*****.**");

            session.SaveOrUpdate(jpalermo);

            //Person 1

            //Person 2
            var jyeager = new Employee("jyeager", "jan", "yeager", "*****@*****.**");

            session.SaveOrUpdate(jyeager);
            //Person 3
            var brheutan = new Employee("brheutan", "Burton", "Rheutan", "*****@*****.**");

            session.SaveOrUpdate(brheutan);

            //Person 4

            //Person 5

            //Person 6
            var fyulnady = new Employee("fyulnady", "Fredy", "Yulnady", "*****@*****.**");

            session.SaveOrUpdate(fyulnady);

            //Person 7

            //Person 8

            //Person 9

            //Person 10

            //Person 11

            //Person 12

            //Person 13

            var hsimpson = new Employee("hsimpson", "Homer", "Simpson", "*****@*****.**");

            session.SaveOrUpdate(hsimpson);

            foreach (ExpenseReportStatus status in ExpenseReportStatus.GetAllItems())
            {
                var order = new ExpenseReport();
                order.Number      = Guid.NewGuid().ToString().Substring(0, 5).ToUpper();
                order.Submitter   = jpalermo;
                order.Approver    = jpalermo;
                order.Status      = status;
                order.Title       = "Work Order starting in status " + status;
                order.Description = "Foo, foo, foo, foo " + status;
                new DateTime(2000, 1, 1, 8, 0, 0);
                order.ChangeStatus(ExpenseReportStatus.Draft);
                order.ChangeStatus(ExpenseReportStatus.Submitted);
                order.ChangeStatus(ExpenseReportStatus.Approved);

                session.SaveOrUpdate(order);
            }

            var order2 = new ExpenseReport();

            order2.Number      = Guid.NewGuid().ToString().Substring(0, 5).ToUpper();
            order2.Submitter   = jpalermo;
            order2.Approver    = jpalermo;
            order2.Status      = ExpenseReportStatus.Approved;
            order2.Title       = "Work Order starting in status ";
            order2.Description = "Foo, foo, foo, foo ";
            new DateTime(2000, 1, 1, 8, 0, 0);
            session.SaveOrUpdate(order2);

            session.Transaction.Commit();
            session.Dispose();
        }
        public void PopulateDatabase()
        {
            new DatabaseTester().Clean();
            EfCoreContext session = new StubbedDataContextFactory().GetContext();


            //Trainer1
            var jpalermo = new Employee(KnownEmployeeUsername, "Jeffrey", "Palermo", "*****@*****.**");

            session.Add(jpalermo);

            //Person 1

            //Person 2

            //Person 3
            var damian = new Employee("damian", "Damian", "Brady", "*****@*****.**");

            session.Add(damian);

            //Person 4

            var scott = new Employee("Scott Wilson", "Scott", "Wilson", "*****@*****.**");

            session.Add(scott);

            //Person 5

            //Person 6
            var paul = new Employee("paul", "Paul", "Stovell", "*****@*****.**");

            session.Add(paul);

            //Person 7

            //Person 8
            var steve = new Employee("Steve Hickman", "Steve", "Hickman", "*****@*****.**");

            session.Add(steve);

            //Person 9

            //Person 10

            //Person 11

            //Person 12

            //Person 13

            var hsimpson = new Employee("hsimpson", "Homer", "Simpson", "*****@*****.**");

            session.Add(hsimpson);

            foreach (ExpenseReportStatus status in ExpenseReportStatus.GetAllItems())
            {
                var report = new ExpenseReport();
                report.Number      = Guid.NewGuid().ToString().Substring(0, 5).ToUpper();
                report.Submitter   = jpalermo;
                report.Approver    = jpalermo;
                report.Status      = status;
                report.Title       = "Expense report starting in status " + status;
                report.Description = "Foo, foo, foo, foo " + status;
                new DateTime(2000, 1, 1, 8, 0, 0);
                report.ChangeStatus(jpalermo, DateTime.Now, ExpenseReportStatus.Draft, ExpenseReportStatus.Draft);
                report.ChangeStatus(jpalermo, DateTime.Now, ExpenseReportStatus.Draft, ExpenseReportStatus.Submitted);
                report.ChangeStatus(jpalermo, DateTime.Now, ExpenseReportStatus.Submitted, ExpenseReportStatus.Approved);

                session.Add(report);
            }

            var report2 = new ExpenseReport();

            report2.Number      = KnownExpenseReportNumber;
            report2.Submitter   = jpalermo;
            report2.Approver    = jpalermo;
            report2.Status      = ExpenseReportStatus.Draft;
            report2.Title       = "Expense report starting in Draft status ";
            report2.Description = "Foo, foo, foo, foo ";
            new DateTime(2000, 1, 1, 8, 0, 0);
            session.Add(report2);

            session.SaveChanges();
            session.Dispose();
        }