public void ShouldSetLastWithdrawnOnEachWithdraw() { var order = new ExpenseReport(); order.Number = "123"; order.Status = ExpenseReportStatus.Submitted; var employee = new Employee(); order.Submitter = employee; var withdrawnDate = new DateTime(2015, 01, 01); var command = new SubmittedToDraftCommand(); command.Execute(new ExecuteTransitionCommand(order, null, employee, withdrawnDate)); Assert.That(order.LastWithdrawn, Is.EqualTo(withdrawnDate)); var withdrawnDate2 = new DateTime(2015, 02, 02); var command2 = new SubmittedToDraftCommand(); command.Execute(new ExecuteTransitionCommand(order, null, employee, withdrawnDate2)); Assert.That(order.LastWithdrawn, Is.Not.EqualTo(withdrawnDate)); Assert.That(order.LastWithdrawn, Is.EqualTo(withdrawnDate2)); }
public void ShouldTransitionStateProperly() { var order = new ExpenseReport(); order.Number = "123"; order.Status = ExpenseReportStatus.Submitted; var employee = new Employee(); order.Submitter = employee; var command = new SubmittedToDraftCommand(); command.Execute(new ExecuteTransitionCommand(order, null, employee, new DateTime())); Assert.That(order.Status, Is.EqualTo(ExpenseReportStatus.Draft)); }