Beispiel #1
0
        public void Should_set_the_status_to_rejected_when_Reject_command_is_executed()
        {
            // Arrange
            var aggregate = PaymentFactory.Create(_dateProvider);

            // Act
            aggregate.Reject(BankTransactionId.Create());

            // Assert
            aggregate.Status.Should().Be(PaymentStatus.Rejected);
        }
Beispiel #2
0
        public void Should_raise_a_PaymentApproved_event_when_Approve_command_is_executed()
        {
            // Arrange
            var aggregate = PaymentFactory.Create(_dateProvider);

            // Act
            aggregate.Approve(BankTransactionId.Create());

            // Assert
            aggregate.Should().HaveRaisedEventOfType <PaymentApproved>();
        }
        public void Should_return_true_when_payment_has_been_rejected()
        {
            // Arrange
            var service = new DomainServices.PaymentService();

            _payment.Reject(BankTransactionId.Create());

            // Act
            var result = service.HasAlreadyBeenProcessed(_payment);

            // Assert
            result.Should().BeTrue();
        }
Beispiel #4
0
        public void Should_raise_a_PaymentRejected_event_when_Reject_command_is_executed()
        {
            // Arrange
            var aggregate     = PaymentFactory.Create(_dateProvider);
            var transactionId = BankTransactionId.Create();

            // Act
            aggregate.Reject(transactionId);

            // Assert
            aggregate.Should().HaveRaisedEventOfType <PaymentRejected>();
            aggregate.TransactionId.Should().Be(transactionId);
        }
Beispiel #5
0
        public void Should_set_the_status_to_approved_when_Approve_command_is_executed()
        {
            // Arrange
            var aggregate     = PaymentFactory.Create(_dateProvider);
            var transactionId = BankTransactionId.Create();

            // Act
            aggregate.Approve(transactionId);

            // Assert
            aggregate.Status.Should().Be(PaymentStatus.Approved);
            aggregate.TransactionId.Should().Be(transactionId);
        }
Beispiel #6
0
        public void Should_throw_when_Reject_is_called_and_status_is_not_pending()
        {
            // Arrange
            var aggregate = PaymentFactory.Create(_dateProvider);

            aggregate.Reject(BankTransactionId.Create());

            // Act
            Action action = () => aggregate.Reject(BankTransactionId.Create());

            // Assert
            action.Should().Throw <PaymentAlreadyProcessedException>();
        }