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 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)); }