public void ShouldSetLastWithdrawnAndCancelledTime()
        {
            var order = new ExpenseReport();
            order.Number = "123";
            order.Status = ExpenseReportStatus.Approved;
            var employee = new Employee();
            order.Approver = employee;

            var cancelledDate = new DateTime(2015, 01, 01);

            var command = new ApprovedToCancelledCommand();

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

            Assert.That(order.LastCancelled, Is.EqualTo(cancelledDate));
            Assert.That(order.LastWithdrawn, Is.EqualTo(cancelledDate));

            var cancelledDate2 = new DateTime(2015, 02, 02);

            var command2 = new ApprovedToCancelledCommand();
            command2.Execute(new ExecuteTransitionCommand(order, null, employee, cancelledDate2));

            Assert.That(order.LastCancelled, Is.Not.EqualTo(cancelledDate));
            Assert.That(order.LastCancelled, Is.EqualTo(cancelledDate2));
        }
        public void ShouldNotBeValidInWrongStatus()
        {
            var order = new ExpenseReport();
            order.Status = ExpenseReportStatus.Submitted;
            var employee = new Employee();
            order.Submitter = employee;

            var command = new ApprovedToCancelledCommand();
            Assert.That(command.IsValid(new ExecuteTransitionCommand{Report = order, CurrentUser = employee}), Is.False);
        }
        public void ShouldTransitionStateProperly()
        {
            var order = new ExpenseReport();
            order.Number = "123";
            order.Status = ExpenseReportStatus.Approved;
            var employee = new Employee();
            order.Submitter = employee;

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

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