예제 #1
0
        public void ShouldNotBeValidWithWrongEmployee()
        {
            var report = new ExpenseReport();

            report.Status = ExpenseReportStatus.Cancelled;
            var employee = new Employee();

            report.Approver = employee;

            var command = new DraftToCancelledCommand();

            Assert.That(command.IsValid(new ExecuteTransitionCommand(report, null, employee, new DateTime())), Is.False);
        }
예제 #2
0
        public void ShouldBeValid()
        {
            var report = new ExpenseReport();

            report.Status = ExpenseReportStatus.Draft;
            var employee = new Employee();

            report.Submitter = employee;

            var command = new DraftToCancelledCommand();

            Assert.That(command.IsValid(new ExecuteTransitionCommand(report, null, employee, new DateTime())), Is.True);
        }
예제 #3
0
        public void ShouldNotBeValidInWrongStatus()
        {
            var order = new ExpenseReport();

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

            order.Approver = employee;

            var command = new DraftToCancelledCommand();

            Assert.That(command.IsValid(new ExecuteTransitionCommand(order, null, employee, new DateTime())), Is.False);
        }
예제 #4
0
        public void ShouldSetLastCancelledOnExecute()
        {
            var report = new ExpenseReport();

            report.Status = ExpenseReportStatus.Cancelled;
            DateTime cancelledDate = new DateTime(2015, 6, 30);
            var      employee      = new Employee();

            report.Submitter = employee;

            var command = new DraftToCancelledCommand();

            command.Execute(new ExecuteTransitionCommand(report, null, employee, cancelledDate));
            Assert.That(report.LastCancelled, Is.EqualTo(cancelledDate));
        }
예제 #5
0
        public void ShouldTransitionStateProperly()
        {
            var report = new ExpenseReport();

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

            report.Approver = employee;

            var command = new DraftToCancelledCommand();

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

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