public void Then_The_Command_Is_Validated_And_The_Service_Not_Called_If_Not_Valid()
        {
            //Arrange
            var expectedCommand = new CreateAccountReservationCommand {
                AccountId = 1
            };

            //Act Assert
            Assert.ThrowsAsync <ArgumentException>(async() =>
            {
                await _handler.Handle(expectedCommand, _cancellationToken);
            });
            _accountReservationsService.Verify(x =>
                                               x.CreateAccountReservation(It.IsAny <CreateAccountReservationCommand>()), Times.Never);
            _unitOfWork.Verify(x => x.AddEvent(It.IsAny <ReservationCreatedEvent>()), Times.Never);
        }
        public async Task Then_If_The_Reservation_Is_For_Levy_The_Event_Is_Created_With_Min_Dates()
        {
            //Arrange
            _command.IsLevyAccount = true;
            _command.StartDate     = null;
            _reservationCreated    = new Reservation(null, _expectedReservationId, ExpectedAccountId, true, DateTime.UtcNow,
                                                     null, null, ReservationStatus.Pending, new Course
            {
                CourseId = "1",
                Level    = 1,
                Title    = "Test Course"
            }, null, 198, "TestName", 0, null);
            _accountReservationsService
            .Setup(x => x.CreateAccountReservation(_command))
            .ReturnsAsync(_reservationCreated);
            _handler = new CreateAccountReservationCommandHandler(_accountReservationsService.Object, _validator.Object, _globalRulesService.Object, _unitOfWork.Object, _accountLegalEntitiesService.Object);

            //Act
            await _handler.Handle(_command, _cancellationToken);

            //Assert
            _unitOfWork.Verify(x => x.AddEvent(It.Is <Func <ReservationCreatedEvent> >(c =>
                                                                                       c.Invoke().Id.Equals(_expectedReservationId) &&
                                                                                       c.Invoke().AccountLegalEntityId.Equals(_reservationCreated.AccountLegalEntityId) &&
                                                                                       c.Invoke().AccountLegalEntityName.Equals(_reservationCreated.AccountLegalEntityName) &&
                                                                                       c.Invoke().StartDate.Equals(DateTime.MinValue) &&
                                                                                       c.Invoke().EndDate.Equals(DateTime.MinValue) &&
                                                                                       c.Invoke().CreatedDate.Equals(_reservationCreated.CreatedDate) &&
                                                                                       c.Invoke().AccountId.Equals(_reservationCreated.AccountId)
                                                                                       )), Times.Once);
        }