Пример #1
0
        public void ShouldValidateConnectorMaxCurrent()
        {
            var command = new AddChargeStationCommand
            {
                Name = "Station1",
                ConnectorMaxCurrent = 0
            };

            FluentActions.Invoking(() =>
                                   SendAsync(command)).Should().Throw <ValidationException>();
        }
Пример #2
0
        public async Task ShouldCreateChargeStation()
        {
            var group = await AddGroupAsync();

            var command = new AddChargeStationCommand
            {
                GroupId             = group.Id,
                ConnectorMaxCurrent = 10,
                Name = "A1"
            };

            var chargeStationId = await SendAsync(command);

            var chargeStation = await FindAsync <ChargeStation>(chargeStationId);

            var connector = await FindAsync <Connector>(1, chargeStationId);

            chargeStation.Should().NotBeNull();
            chargeStation.Name.Should().Be(command.Name);
            connector.MaxCurrent.Should().Be(command.ConnectorMaxCurrent);
        }
 public async Task <ActionResult <long> > Create(AddChargeStationCommand command)
 {
     return(await Mediator.Send(command));
 }
        public async Task <ActionResult <ChargeStationDto> > CreateChargeStation(AddChargeStationCommand command)
        {
            var response = await Mediator.Send(command);

            return(CreatedAtAction(nameof(CreateChargeStation), response));
        }