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

            var command = new ApprovedToSubmittedCommand();
            Assert.That(command.IsValid(new ExecuteTransitionCommand(order, null, employee, new DateTime())), Is.False);
        }
        public void AssistantShouldDecline()
        {
            var order = new ExpenseReport();
            order.Number = "123";
            order.Status = ExpenseReportStatus.Approved;
            var manager = new Manager();
            var assistant = new Employee();
            order.Approver = manager;
            manager.AdminAssistant = assistant;

            var command = new ApprovedToSubmittedCommand();
            Assert.That(command.IsValid(new ExecuteTransitionCommand(order, null, assistant, new DateTime())), Is.True);
        }
        public void ShouldPopulateLastDeclinedEachTime()
        {
            var order = new ExpenseReport();
            order.Number = "123";
            order.Status = ExpenseReportStatus.Approved;
            var employee = new Employee();
            order.Approver = employee;

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

            var command = new ApprovedToSubmittedCommand();
            command.Execute(new ExecuteTransitionCommand(order, null, employee, declineDate));

            Assert.That(order.LastDeclined, Is.EqualTo(declineDate));

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

            var command2 = new ApprovedToSubmittedCommand();
            command2.Execute(new ExecuteTransitionCommand(order, null, employee, declineDate2));

            Assert.That(order.LastDeclined, Is.Not.EqualTo(declineDate));
            Assert.That(order.LastDeclined, Is.EqualTo(declineDate2));
        }
        public void ShouldTransitionStateProperly()
        {
            var order = new ExpenseReport();
            order.Number = "123";
            order.Status = ExpenseReportStatus.Approved;
            var employee = new Employee();
            order.Approver = employee;

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

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