test

Wordle Workshop - API Endpoints Implementation

Task 0: Setup

  1. Navigate to the Wordle Project.
  2. Go to Plan -> Issues -> New Item
  3. In the Description drop down select `Workshop Instructions``
  4. Assign the issue to yourself
  5. Press Create Issue
  6. In the Issue press Create merge request

Task 1: Get an overview of the application

Objective

Get an overview of the application. Use Duo Chat to understand the structure of the application.

Instructions

  1. Open Duo Chat
  2. use the /include and choose Files. Search for .csand select multiple files by pressing Enter.
  3. Ask Duo Chat to create a Mermaid class diagram of the application.
  4. Paste the markdown code into this mermaid live editor.

Task 2: Implement GetGameState Endpoint

Objective

Create a method in the WordleController.cs class that provides a GetGameState endpoint to retrieve the complete state of a specific game.

Requirements

  1. Endpoint: GET /api/wordle/{gameId}/state
  2. Response: Return complete game state information
  3. Error Handling: Handle cases where game doesn't exist
  4. Response Type: Use appropriate HTTP status codes
  5. Expected Response Structure:
    {
      "gameId": "abc12345",
      "targetWord": {
        "value": "*****"
      },
      "maxAttempts": 6,
      "guesses": [],
      "isGameOver": false,
      "isWon": false,
      "remainingAttempts": 6,
      "startTime": "2025-11-04T17:37:59.520Z"
    }

Instructions

  1. Go to the WordleController.cs class
  2. Add the following comment: // Create a stats endpoint that gives information about the state of a specific game and the last guess
  3. Press enter and notice the GitLab Tanuki item - Wait for a suggestion

Task 3: Fix the GetGame endpoint

Objective

Add error handling for when the given key does not exist.

Requirements

  1. Endpoint: GET /api/wordle/new
  2. Response: Return error message when given key is not found

Instructions

  1. Go to the WordleController.cs class
  2. Highlight the GetGame function.
  3. Right click -> GitLab Duo Chat -> Fix
  4. Look at the result and press Insert at cursor

Task 4: Add unit tests for the IsValidLength method

Objective

Add unit tests for the IsValidLength method in the Word.cs class.

Instructions

  1. Go to the Word.cs class
  2. Highlight the IsValidLength function.
  3. Go to the Duo Chat and type /tests use xunit only
  4. Verify the results
  5. Navigate to the WordTests.cs file and paste the tests into the file

Task 4: Add unit tests for the IsValidLength method

Objective

Add unit tests for the IsValidLength method in the Word.cs class.

Instructions

  1. Go to the Word.cs class
  2. Highlight the IsValidLength function.
  3. Go to the Duo Chat and type /tests use xunit only
  4. Verify the results
  5. Navigate to the WordTests.cs file and paste the tests into the file