public async Task Run([QueueTrigger("betupdated", Connection = "azurestorageconnectionstring")] string jsonEvent, ILogger log) { log.LogInformation($"C# Queue trigger function processed: {jsonEvent}"); var ev = JsonConvert.DeserializeObject <BetUpdated>(jsonEvent); var command = new UpdateBetCommand(ev.BetId); await _betModule.ExecuteCommandAsync(command).ConfigureAwait(false); }
public async Task ShouldThrowBetUnknownExceptionIfBetDoesNotExist() { var betId = Guid.NewGuid(); var command = new UpdateBetCommand(betId); var handler = new UpdateBetCommandHandler(new InMemoryBetRepository(), null); var record = await Record.ExceptionAsync(() => handler.Handle(command, default)); Assert.IsType <BetUnknownException>(record); }