public void CheckIfObjectIntersectsWall_Intersection_Edge_Test() { /// Initialize a Level with no coins /// this is the level (100x50 with a wall in the middle) /// ------------- /// x- /// ------------- GameLogicSvc target = new GameLogicSvc(); IVModel model = new VModel(); Point size = new Point(); size.X = 100; size.Y = 50; model.Map = new Map2d(size); // Insert a Wall exactly in the middle model.Map.InsertWall(new Wall() { Start = new Point() { X = 50, Y = 25 }, End = new Point() { X = 51, Y = 25 } }); ModelPlayer player = new ModelPlayer(model, 0, 10); // what is the size? Point atPosition = new Point() { X = 40, Y = 25 }; bool result = target.checkIfObjectIntersectsWallAt(player, atPosition); Assert.AreEqual(true, result); }
public void IsPointOnLine_StartingEdge_Vertical_Test() { GameLogicSvc target = new GameLogicSvc(); Wall w = new Wall() { Start = new Point() { X = 50, Y = 0 }, End = new Point() { X = 50, Y = 50 } }; Point p = new Point() { X = 50, Y = 0 }; bool isOnLine = target.isPointOnLine(p, w); Assert.AreEqual(true, isOnLine); }
public void IsPointOnLine_StartingEdge_Horizontal_Test() { GameLogicSvc target = new GameLogicSvc(); Wall w = new Wall() { Start = new Point() { X = 0, Y = 25 }, End = new Point() { X = 100, Y = 25 } }; Point p = new Point() { X = 0, Y = 25 }; bool isOnLine = target.isPointOnLine(p, w); Assert.AreEqual(true, isOnLine); }
public void IsPointOnLine_None_Vertical_Small_Test() { GameLogicSvc target = new GameLogicSvc(); Wall w = new Wall() { Start = new Point() { X = 50, Y = 25 }, End = new Point() { X = 50, Y = 24 } }; Point p = new Point() { X = 50, Y = 23 }; bool isOnLine = target.isPointOnLine(p, w); Assert.AreEqual(false, isOnLine); }
public void IsBetweenStartAndEnd_Valid_Vertical_Test() { GameLogicSvc target = new GameLogicSvc(); Wall w = new Wall() { Start = new Point() { X = 10, Y = 10 }, End = new Point() { X = 10, Y = 20 } }; Point p = new Point() { X = 10, Y = 10 }; bool result = target.isBetweenStartAndEnd(p, w); Assert.AreEqual(true, result); }
public void IsBetweenStartAndEnd_Invalid_Horizontal_Test() { GameLogicSvc target = new GameLogicSvc(); Wall w = new Wall() { Start = new Point() { X = 10, Y = 10 }, End = new Point() { X = 20, Y = 10 } }; Point p = new Point() { X = 9, Y = 10 }; bool result = target.isBetweenStartAndEnd(p, w); Assert.AreEqual(false, result); }