public void RegisterPlayerCommand_CanBeCreated_IsCreated() { RegisterPlayerCommand command = RegisterPlayerCommand.Create(PlayerTestData.AggregateId, PlayerTestData.RegisterPlayerRequest); command.ShouldNotBeNull(); command.CommandId.ShouldNotBe(Guid.Empty); command.PlayerId.ShouldBe(PlayerTestData.AggregateId); command.RegisterPlayerRequest.ShouldNotBeNull(); command.RegisterPlayerRequest.ShouldBe(PlayerTestData.RegisterPlayerRequest); }
public async Task <IActionResult> CreatePlayer([FromBody] RegisterPlayerRequest request, CancellationToken cancellationToken) { Guid playerId = Guid.NewGuid(); // Create the command RegisterPlayerCommand command = RegisterPlayerCommand.Create(playerId, request); // Route the command await this.CommandRouter.Route(command, cancellationToken); // return the result return(this.Created($"{PlayerController.ControllerRoute}/{playerId}", new RegisterPlayerResponse { PlayerId = playerId })); }
public static RegisterPlayerCommand GetRegisterPlayerCommand() { return(RegisterPlayerCommand.Create(PlayerTestData.AggregateId, PlayerTestData.RegisterPlayerRequest)); }