Beispiel #1
0
        public void TestIsInsideLevelGrid()
        {
            var level = new MockLevel(new Size(3));

            Assert.True(level.IsInsideLevelGrid(new Vector2D(1, 1)));
            Assert.False(level.IsInsideLevelGrid(new Vector2D(4, 1)));
        }
Beispiel #2
0
        public void TestSetTileWithScreenPositionIn2D()
        {
            var level = new MockLevel(new Size(3));

            SetTilesWithScreenPosition(level);
            AssertTilesWithScreenPosition(level);
        }
Beispiel #3
0
        public void TestLevelTileChange()
        {
            var level = new MockLevel(new Size(1));

            level.TileChanged += position => CheckTileHasChanged(level, position);
            level.SetTile(Vector2D.Zero, LevelTileType.Blocked);
        }
Beispiel #4
0
        public void TestAddWave()
        {
            var level = new MockLevel(new Size(3));

            Assert.AreEqual(0, level.Waves.Count);
            level.AddWave(new Wave(0.0f, 0.0f, ""));
            Assert.AreEqual(1, level.Waves.Count);
        }
Beispiel #5
0
        public void TestLoadData()
        {
            var level = new MockLevel(new Size());

            Assert.AreEqual(new Size(), level.Size);
            level.LoadTestData();
            Assert.AreEqual(new Size(4, 3), level.Size);
        }
Beispiel #6
0
        public void TestGetAllTilesOfType()
        {
            var level = new MockLevel(new Size(2));

            level.SetTile(new Vector2D(0, 0), LevelTileType.SpawnPoint);
            level.SetTile(new Vector2D(0, 1), LevelTileType.SpawnPoint);
            Assert.AreEqual(2, level.GetAllTilesOfType(LevelTileType.SpawnPoint).Count);
        }
Beispiel #7
0
        public void TestSetTileWithScreenPositionIn3D()
        {
            SetUpCamera();
            var level = new MockLevel(new Size(3))
            {
                RenderIn3D = true
            };

            SetTilesWithScreenPosition(level);
            AssertTilesWithScreenPosition(level);
        }
Beispiel #8
0
        public void TestLevelTileColor()
        {
            var level = new MockLevel(new Size(5));

            Assert.AreEqual(Color.LightGray, level.GetColor(LevelTileType.Blocked));
            Assert.AreEqual(Color.CornflowerBlue, level.GetColor(LevelTileType.Placeable));
            Assert.AreEqual(Color.LightBlue, level.GetColor(LevelTileType.BlockedPlaceable));
            Assert.AreEqual(Color.LightBlue, level.GetColor(LevelTileType.LightBlue));
            Assert.AreEqual(Color.Red, level.GetColor(LevelTileType.Red));
            Assert.AreEqual(Color.Green, level.GetColor(LevelTileType.Green));
            Assert.AreEqual(Color.Blue, level.GetColor(LevelTileType.Blue));
            Assert.AreEqual(Color.Yellow, level.GetColor(LevelTileType.Yellow));
            Assert.AreEqual(Color.Brown, level.GetColor(LevelTileType.Brown));
            Assert.AreEqual(Color.Gray, level.GetColor(LevelTileType.Gray));
            Assert.AreEqual(Color.PaleGreen, level.GetColor(LevelTileType.SpawnPoint));
            Assert.AreEqual(Color.DarkGreen, level.GetColor(LevelTileType.ExitPoint));
            Assert.AreEqual(Color.Black, level.GetColor(LevelTileType.Nothing));
            Assert.AreEqual(Color.TransparentBlack, level.GetColor(LevelTileType.NoSelection));
        }
Beispiel #9
0
        public void TestToTextForXml()
        {
            var level = new MockLevel(new Size(3, 4));

            level.SetTile(new Vector2D(0, 0), LevelTileType.Nothing);
            level.SetTile(new Vector2D(1, 0), LevelTileType.Blocked);
            level.SetTile(new Vector2D(2, 0), LevelTileType.Placeable);
            level.SetTile(new Vector2D(0, 1), LevelTileType.BlockedPlaceable);
            level.SetTile(new Vector2D(1, 1), LevelTileType.Red);
            level.SetTile(new Vector2D(2, 1), LevelTileType.Green);
            level.SetTile(new Vector2D(0, 2), LevelTileType.Blue);
            level.SetTile(new Vector2D(1, 2), LevelTileType.Yellow);
            level.SetTile(new Vector2D(2, 2), LevelTileType.Brown);
            level.SetTile(new Vector2D(0, 3), LevelTileType.Gray);
            level.SetTile(new Vector2D(1, 3), LevelTileType.SpawnPoint);
            level.SetTile(new Vector2D(2, 3), LevelTileType.ExitPoint);
            string text = level.ToTextForXml();

            Assert.AreEqual("\r\n.XP\r\nLRG\r\nBYO\r\nASE\r\n", text);
        }
Beispiel #10
0
		public void TestLevelTileChange()
		{
			var level = new MockLevel(new Size(1));
			level.TileChanged += position => CheckTileHasChanged(level, position);
			level.SetTile(Vector2D.Zero, LevelTileType.Blocked);
		}
Beispiel #11
0
		public void TestGetAllTilesOfType()
		{
			var level = new MockLevel(new Size(2));
			level.SetTile(new Vector2D(0, 0), LevelTileType.SpawnPoint);
			level.SetTile(new Vector2D(0, 1), LevelTileType.SpawnPoint);
			Assert.AreEqual(2, level.GetAllTilesOfType(LevelTileType.SpawnPoint).Count);
		}
Beispiel #12
0
		public void TestIsInsideLevelGrid()
		{
			var level = new MockLevel(new Size(3));
			Assert.True(level.IsInsideLevelGrid(new Vector2D(1, 1)));
			Assert.False(level.IsInsideLevelGrid(new Vector2D(4, 1)));
		}
Beispiel #13
0
		public void TestAddWave()
		{
			var level = new MockLevel(new Size(3));
			Assert.AreEqual(0, level.Waves.Count);
			level.AddWave(new Wave(0.0f, 0.0f, ""));
			Assert.AreEqual(1, level.Waves.Count);
		}
Beispiel #14
0
		public void TestToTextForXml()
		{
			var level = new MockLevel(new Size(3, 4));
			level.SetTile(new Vector2D(0, 0), LevelTileType.Nothing);
			level.SetTile(new Vector2D(1, 0), LevelTileType.Blocked);
			level.SetTile(new Vector2D(2, 0), LevelTileType.Placeable);
			level.SetTile(new Vector2D(0, 1), LevelTileType.BlockedPlaceable);
			level.SetTile(new Vector2D(1, 1), LevelTileType.Red);
			level.SetTile(new Vector2D(2, 1), LevelTileType.Green);
			level.SetTile(new Vector2D(0, 2), LevelTileType.Blue);
			level.SetTile(new Vector2D(1, 2), LevelTileType.Yellow);
			level.SetTile(new Vector2D(2, 2), LevelTileType.Brown);
			level.SetTile(new Vector2D(0, 3), LevelTileType.Gray);
			level.SetTile(new Vector2D(1, 3), LevelTileType.SpawnPoint);
			level.SetTile(new Vector2D(2, 3), LevelTileType.ExitPoint);
			string text = level.ToTextForXml();
			Assert.AreEqual("\r\n.XP\r\nLRG\r\nBYO\r\nASE\r\n", text);
		}
Beispiel #15
0
		public void TestLoadData()
		{
			var level = new MockLevel(new Size());
			Assert.AreEqual(new Size(), level.Size);
			level.LoadTestData();
			Assert.AreEqual(new Size(4, 3), level.Size);
		}
Beispiel #16
0
		public void TestLevelTileColor()
		{
			var level = new MockLevel(new Size(5));
			Assert.AreEqual(Color.LightGray, level.GetColor(LevelTileType.Blocked));
			Assert.AreEqual(Color.CornflowerBlue, level.GetColor(LevelTileType.Placeable));
			Assert.AreEqual(Color.LightBlue, level.GetColor(LevelTileType.BlockedPlaceable));
			Assert.AreEqual(Color.LightBlue, level.GetColor(LevelTileType.LightBlue));
			Assert.AreEqual(Color.Red, level.GetColor(LevelTileType.Red));
			Assert.AreEqual(Color.Green, level.GetColor(LevelTileType.Green));
			Assert.AreEqual(Color.Blue, level.GetColor(LevelTileType.Blue));
			Assert.AreEqual(Color.Yellow, level.GetColor(LevelTileType.Yellow));
			Assert.AreEqual(Color.Brown, level.GetColor(LevelTileType.Brown));
			Assert.AreEqual(Color.Gray, level.GetColor(LevelTileType.Gray));
			Assert.AreEqual(Color.PaleGreen, level.GetColor(LevelTileType.SpawnPoint));
			Assert.AreEqual(Color.DarkGreen, level.GetColor(LevelTileType.ExitPoint));
			Assert.AreEqual(Color.Black, level.GetColor(LevelTileType.Nothing));
			Assert.AreEqual(Color.TransparentBlack, level.GetColor(LevelTileType.NoSelection));
		}
Beispiel #17
0
		public void TestSetTileWithScreenPositionIn3D()
		{
			SetUpCamera();
			var level = new MockLevel(new Size(3)) { RenderIn3D = true };
			SetTilesWithScreenPosition(level);
			AssertTilesWithScreenPosition(level);
		}
Beispiel #18
0
		public void TestSetTileWithScreenPositionIn2D()
		{
			var level = new MockLevel(new Size(3));
			SetTilesWithScreenPosition(level);
			AssertTilesWithScreenPosition(level);
		}