-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGameControllerTest.cs
57 lines (50 loc) · 1.7 KB
/
GameControllerTest.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//-----------------------------------------------------------
// File: GamecontrollerTest.cs
// Desc: Holds the Unit Tests for the Gamecontroller Class
//-----------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace JoustModel
{
[TestClass]
public class SerialTest
{
[TestMethod]
public void Load_Default()
{
GameController game = new GameController();
World.Instance.objects.Clear();
game.Load(DateTime.Now.ToString("17-42-49"));
Assert.IsTrue(game.WorldRef.objects.Count == 4);
Assert.IsTrue(game.WorldRef.objects[0].coords.x == 5);
Assert.IsTrue((game.WorldRef.objects[3] as Buzzard).speed == 100);
}
[TestMethod]
public void Save_Default()
{
GameController game = new GameController();
World.Instance.objects.Clear();
string testLine = game.Save();
Assert.IsTrue(testLine == "");
}
[TestMethod]
public void Save_OneObjEach()
{
GameController game = new GameController();
World.Instance.objects.Clear();
new Ostrich();
new Egg();
new Pterodactyl();
new Buzzard();
new Platform();
new Respawn();
new Base();
string testLine = game.Save();
Assert.IsTrue(testLine == "Ostrich,0,3,0,0,0,0:Egg,0,0,0,0:Pterodactyl,0,315,0,0:Buzzard,3,0,0,0:Platform,0,0:Respawn,0,0:Base,0,0:");
}
}
}