示例#1
0
 public GenericCommandResult Delete(
     [FromBody] DeleteFlightCommand command,
     [FromServices] FlightHandler handler
     )
 {
     return((GenericCommandResult)handler.Handle(command));
 }
示例#2
0
        public async Task <GenericCommandResult> ImportFromMachAsync(
            [FromServices] FlightHandler handler
            )
        {
            HttpResponseMessage response = await client.GetAsync("http://us-central1-mach-app.cloudfunctions.net/api/flights?departure=SBSP");

            var data = await response.Content.ReadAsStreamAsync();

            var commands = await JsonSerializer.DeserializeAsync <List <CreateFlightFromMachCommand> >(data);

            foreach (var command in commands)
            {
                handler.Handle(command);
            }
            return(new GenericCommandResult(true, "The Flights has been imported", commands));
        }
 public void Dado_um_comando_invalido_deve_interromper_a_execucao()
 {
     _result = (GenericCommandResult)_handler.Handle(_invalidFlight);
     Assert.AreEqual(_result.Success, false);
 }