-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangeDirectionTest.cs
More file actions
75 lines (67 loc) · 3.39 KB
/
ChangeDirectionTest.cs
File metadata and controls
75 lines (67 loc) · 3.39 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Text;
using Minecraft.Control;
using Minecraft.Models;
using System.Drawing;
namespace UnitTestProject1
{
[TestClass]
public class ChangeDirectionTest
{
private readonly int[,] mapWithoutBlockInto = { { 1, 1, 1, 1, 1, 1 }, { 1, 0, 0, 0, 0, 1 }, { 1, 0, 0, 0, 0, 1 },
{ 1, 0, 0, 0, 0, 1 }, { 1, 0, 0, 0, 0, 1 }, { 1, 0, 0, 0, 0, 1 }, { 1, 0, 0, 0, 0, 1 }, { 1, 1, 1, 1, 1, 1 } };
private readonly int[,] mapWithBlockInto = { { 1, 1, 1, 1, 1, 1 }, { 1, 0, 0, 1, 0, 1 }, { 1, 0, 0, 1, 0, 1 },
{ 1, 0, 0, 1, 0, 1 }, { 1, 0, 0, 0, 0, 1 }, { 1, 0, 1, 0, 0, 1 }, { 1, 0, 1, 0, 0, 1 }, { 1, 1, 1, 1, 1, 1 } };
private readonly int[] decorationObject = { 0, 4, 5, 8 };
[TestMethod]
public void DirectionUpCaveTrial()
{
var player = new Player(new Point() { X = 120,Y=80});
var screen = new ScreenPoint(new Point() { X = 0, Y = 0 });
player.ChangeDirectionPlayer(screen, mapWithBlockInto, decorationObject, Direction.Up, Trials.CaveTrial);
Assert.IsTrue(new Point(){X=120,Y=72}==player.GetPosition());
}
[TestMethod]
public void DirectionDownCaveTrial()
{
var player = new Player(new Point() { X = 120, Y = 80 });
var screen = new ScreenPoint(new Point() { X = 0, Y = 0 });
player.ChangeDirectionPlayer(screen, mapWithBlockInto, decorationObject, Direction.Down, Trials.CaveTrial);
Assert.IsTrue(new Point() { X = 120, Y = 88 } == player.GetPosition());
}
[TestMethod]
public void DirectionLeftCaveTrial()
{
var player = new Player(new Point() { X = 120, Y = 80 });
var screen = new ScreenPoint(new Point() { X = 0, Y = 0 });
player.ChangeDirectionPlayer(screen, mapWithBlockInto, decorationObject, Direction.Left, Trials.CaveTrial);
Assert.IsTrue(new Point() { X = 112, Y = 80 } == player.GetPosition());
}
[TestMethod]
public void DirectionRightCaveTrial()
{
var player = new Player(new Point() { X = 120, Y = 80 });
var screen = new ScreenPoint(new Point() { X = 0, Y = 0 });
player.ChangeDirectionPlayer(screen, mapWithBlockInto, decorationObject, Direction.Right, Trials.CaveTrial);
Assert.IsTrue(new Point() { X = 128, Y = 80 } == player.GetPosition());
}
[TestMethod]
public void IsNotWayToDirectionUpMainTrial()
{
var player = new Player(new Point() { X = 120, Y = 70});
var screen = new ScreenPoint(new Point() { X = 0, Y = 0 });
player.ChangeDirectionPlayer(screen, mapWithoutBlockInto, decorationObject, Direction.Up, Trials.ArenaTrial);
Assert.IsTrue(player.GetPosition().Y==70);
}
[TestMethod]
public void IsWayToDirectionDownMainTrial()
{
var player = new Player(new Point() { X = 120, Y = 70 });
var screen = new ScreenPoint(new Point() { X = 0, Y = 0 });
player.ChangeDirectionPlayer(screen, mapWithoutBlockInto, decorationObject, Direction.Down, Trials.ArenaTrial);
Assert.IsTrue(player.GetPosition().Y == 78);
}
}
}