Summary and manual testing
To summarize what we've learned so far:
- We've created a decentralized Tic Tac Toe game using Rell and Chromia.
- We've covered writing unit tests and starting a test node.
- We've connected a Unity app to our dapp using the Postchain C# client.
Now, let's perform manual testing by adding a few dummy accounts and observing them through our Unity game.
Add dummy accounts
We'll start by adding three users using the Chromia CLI:
chr node start # Unless you've already done this
chr keygen --file .alice
chr keygen --file .bob
chr keygen --file .trudy
Make a note of the public keys, as we'll use them to add the users directly using our test operation:
chr tx create_user Alice <alice-pubkey>
chr tx create_user Bob <bob-pubkey>
chr tx create_user Trudy <trudy-pubkey>
Create Dummy Games
Now, let’s simulate some Tic Tac Toe games between these users. You’ll need to interact with the dapp's contract functions via the Postchain client. Use these sample operations:
// Assuming you have a method to create a game in your Tic Tac Toe dapp
var createGameOp = new Operation("create_game", "Alice", "Bob");
await client.SendTransaction(new TransactionBuilder().AddOperation(createGameOp).AddSignatureProvider(signerAlice).Build());
// Example move operations
var moveOp = new Operation("make_move", "game-id", "Alice", "X", 1, 1);
await client.SendTransaction(new TransactionBuilder().AddOperation(moveOp).AddSignatureProvider(signerAlice).Build());
Start the Unity game
To view the changes in your Unity game, start the game and ensure that it is connected to the blockchain. You should be able to:
- Create new games.
- Make moves as different players.
- Observe the game state updating in real-time.
Make sure that your Unity client is handling blockchain interactions properly, and confirm that you can see the changes in the game state as expected.
Congratulations! You have successfully built and tested your Tic Tac Toe dapp on Chromia.