public void ShouldBeValid()
        {
            var order = new ExpenseReport();
            order.Status = ExpenseReportStatus.Draft;
            var employee = new Employee();
            order.Submitter = employee;

            var command = new DraftToCancelledCommand();
            Assert.That(command.IsValid(new ExecuteTransitionCommand(order, null, employee, new DateTime())), Is.True);
        }
        public void ShouldNotBeValidWithWrongEmployee()
        {
            var order = new ExpenseReport();
            order.Status = ExpenseReportStatus.Cancelled;
            var employee = new Employee();
            order.Approver = employee;

            var command = new DraftToCancelledCommand();
            Assert.That(command.IsValid(new ExecuteTransitionCommand(order, null, employee, new DateTime())), Is.False);
        }
        public void ShouldNotBeValidInWrongStatus()
        {
            var report = new ExpenseReport();
            report.Status = ExpenseReportStatus.Draft;
            var employee = new Employee();
            report.Approver = employee;

            var command = new DraftToCancelledCommand();
            Assert.That(command.IsValid(new ExecuteTransitionCommand(report, null, employee, new DateTime())), Is.False);
        }
        public void ShouldSetLastCancelledOnExecute()
        {
            var order = new ExpenseReport();
            order.Status = ExpenseReportStatus.Cancelled;
            DateTime cancelledDate = new DateTime(2015,6,30);
            var employee = new Employee();
            order.Submitter = employee;

            var command = new DraftToCancelledCommand();
            command.Execute(new ExecuteTransitionCommand(order, null, employee, cancelledDate));
            Assert.That(order.LastCancelled, Is.EqualTo(cancelledDate));
        }
        public void ShouldTransitionStateProperly()
        {
            var order = new ExpenseReport();
            order.Number = "123";
            order.Status = ExpenseReportStatus.Draft;
            var employee = new Employee();
            order.Approver = employee;

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

            Assert.That(order.Status, Is.EqualTo(ExpenseReportStatus.Cancelled));
        }