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);
        }
Example #2
0
        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
            }));
        }
Example #3
0
 public static RegisterPlayerCommand GetRegisterPlayerCommand()
 {
     return(RegisterPlayerCommand.Create(PlayerTestData.AggregateId, PlayerTestData.RegisterPlayerRequest));
 }