public void FindWallIndex() { //arrange int height = 15; int width = 15; IDesigner theLevel = new Designer(); theLevel.LevelBuilder(height, width); theLevel.AddWall(2, 2); theLevel.AddWall(3, 2); theLevel.AddWall(4, 2); //act string testing = theLevel.LocateParts(Parts.Wall); //assert Assert.AreEqual(testing, "Wall at 2,2. Wall at 3,2. Wall at 4,2. "); }
public void AddWall() { int width = 10; int height = 12; IDesigner theLevel = new Designer(); theLevel.LevelBuilder(width, height); theLevel.AddWall(1, 1); Assert.AreEqual(theLevel.GetPartAtIndex(1, 1), Parts.Wall); }
public void TestIfWallReturnsString() { //arrange int height = 15; int width = 15; IDesigner theLevel = new Designer(); theLevel.LevelBuilder(height, width); theLevel.AddWall(2, 2); string theType = theLevel.GetPartAtIndex(2, 2).ToString(); Assert.IsInstanceOfType(theType, typeof(string), "Expected a string but got something else. Please check!"); Assert.AreEqual(theType, "Wall"); }
public void ThrowAssertForAddingWallOutsideAGrid() { //arrange int height = 5; int width = 8; IDesigner theLevel = new Designer(); theLevel.LevelBuilder(height, width); //Check that IndexOutOfRangeException is thrown if //attempting to add something outside of the grid try { theLevel.AddWall(5, 9); } catch (ArgumentException e) { // assert StringAssert.Contains(e.Message, OutOfGridMessage); return; } Assert.Fail("No exception was thrown. (Was allowed to place Wall outside of Grid)"); }