示例#1
0
        public void ShouldExecuteDraftTransition()
        {
            new DatabaseTester().Clean();

            var report = new ExpenseReport();

            report.Number = "123";
            report.Status = ExpenseReportStatus.Draft;
            var employee = new Employee("jpalermo", "Jeffrey", "Palermo", "jeffrey @ clear dash measure.com");

            report.Submitter = employee;
            report.Approver  = employee;

            using (EfCoreContext context = new StubbedDataContextFactory().GetContext())
            {
                context.UpdateRange(employee, report);
                context.SaveChanges();
            }

            var command = new ExecuteTransitionCommand(report, "Save Draft", employee, new DateTime(2001, 1, 1));

            IContainer container = DependencyRegistrarModule.EnsureDependenciesRegistered();
            var        bus       = container.GetInstance <Bus>();

            ExecuteTransitionResult result = bus.Send(command);

            result.NewStatus.ShouldEqual("Drafting");
        }