Example #1
0
        public void ShouldTransitionStateProperly()
        {
            var order = new ExpenseReport();

            order.Number = "123";
            order.Status = ExpenseReportStatus.Draft;
            var employee = new Employee();

            order.Submitter = employee;

            var command = new DraftingCommand();

            command.Execute(new ExecuteTransitionCommand(order, null, employee, new DateTime()));

            Assert.That(order.Status, Is.EqualTo(ExpenseReportStatus.Draft));
        }
Example #2
0
        public void ShouldTransitionStateProperly()
        {
            var order = new ExpenseReport();

            order.Number = "123";
            order.Status = ExpenseReportStatus.Draft;
            var employee = new Employee();

            order.Submitter = employee;

            var mocks          = new MockRepository();
            var commandVisitor = mocks.DynamicMock <IStateCommandVisitor>();

            commandVisitor.Save(order);
            commandVisitor.GoToEdit(order);
            mocks.ReplayAll();

            var command = new DraftingCommand(order, employee);

            command.Execute(commandVisitor);

            mocks.VerifyAll();
            Assert.That(order.Status, Is.EqualTo(ExpenseReportStatus.Draft));
        }