-
Notifications
You must be signed in to change notification settings - Fork 5
/
GameTests.cs
32 lines (30 loc) · 1.05 KB
/
GameTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.ServiceFabric.Actors;
using Microsoft.ServiceFabric.Actors.Client;
using Game.Interfaces;
namespace TicTacToeTests
{
[TestClass]
public class GameTests
{
[TestMethod]
public void APlayerCanOnlyJoinOnce()
{
var gameId = ActorId.CreateRandom();
var game = ActorProxy.Create<IGame>(gameId, "fabric:/ActorTicTacToeApplication");
var result1 = game.JoinGameAsync(1L, "Player 1").Result;
var result2 = game.JoinGameAsync(1L, "Player 1").Result;
Assert.AreEqual(false, result1 & result2);
}
[TestMethod]
public void GameCanBeStartedWith2Player()
{
var gameId = ActorId.CreateRandom();
var game = ActorProxy.Create<IGame>(gameId, "fabric:/ActorTicTacToeApplication");
game.JoinGameAsync(1L, "Player 1").Wait();
var result = game.MakeMoveAsync(1L, 0, 0).Result;
Assert.AreEqual(false, result);
}
}
}