public async void HandleRegisterParkingCommand_Calls_Database() { // Setup var input = new RegisterParkingCommand(); this.mockDb.Setup(x => x.RegisterCarParkingEntry(It.IsAny <ParkingRegistrationDAO>())); // Act await this.target.Handle(input); // Assert this.mockDb.Verify(x => x.RegisterCarParkingEntry(It.IsAny <ParkingRegistrationDAO>())); }
public async void HandleRegisterParkingCommand_Calls_Mapper() { // Setup var input = new RegisterParkingCommand(); this.mockMapper.Setup(x => x.Map <ParkingRegistrationDAO>(It.IsAny <RegisterParkingCommand>())) .Returns(new ParkingRegistrationDAO()); // Act await this.target.Handle(input); // Assert this.mockMapper.Verify(x => x.Map <ParkingRegistrationDAO>(It.IsAny <RegisterParkingCommand>())); }
public void RegisterParkingCommand_MapsTo_ParkingRegistrationDAO() { // Arrange var input = new RegisterParkingCommand { ChargeType = ChargeType.ShortStay, EntryDateTime = new DateTime(2019, 3, 5, 4, 15, 0), RegistrationNumber = "ABC 123" }; // Act var actual = this.target.Map <ParkingRegistrationDAO>(input); // Assert actual.Id.ShouldBe(0); actual.RegistrationNumber.ShouldBe(input.RegistrationNumber); actual.EntryDateTime.ShouldBe(input.EntryDateTime); actual.ChargeType.ShouldBe(input.ChargeType); }
/// <inheritdoc/> public async Task Handle(RegisterParkingCommand command) { this.db.RegisterCarParkingEntry(this.mapper.Map <ParkingRegistrationDAO>(command)); }