public void AddHallCollideExistingHall() { // add on top of existing hall, no consequences TestFloorPlan floorPlan = TestFloorPlan.InitFloorToContext( new Loc(22, 14), Array.Empty <Rect>(), new Rect[] { new Rect(1, 1, 2, 3) }, Array.Empty <Tuple <char, char> >()); TestFloorPlan compareFloorPlan = TestFloorPlan.InitFloorToContext( new Loc(22, 14), Array.Empty <Rect>(), new Rect[] { new Rect(1, 1, 2, 3), new Rect(2, 2, 4, 4) }, Array.Empty <Tuple <char, char> >()); var gen = new Mock <TestFloorPlanGen>(MockBehavior.Loose) { CallBase = true }; gen.SetupGet(p => p.Draw).Returns(new Rect(2, 2, 4, 4)); gen.Object.Identifier = 'b'; floorPlan.AddHall(gen.Object); TestFloorPlan.CompareFloorPlans(floorPlan, compareFloorPlan); }
public void AddHall() { // add to empty space TestFloorPlan floorPlan = TestFloorPlan.InitFloorToContext( new Loc(22, 14), Array.Empty <Rect>(), Array.Empty <Rect>(), Array.Empty <Tuple <char, char> >()); TestFloorPlan compareFloorPlan = TestFloorPlan.InitFloorToContext( new Loc(22, 14), Array.Empty <Rect>(), new Rect[] { new Rect(1, 1, 2, 3) }, Array.Empty <Tuple <char, char> >()); var gen = new Mock <TestFloorPlanGen>(MockBehavior.Loose) { CallBase = true }; gen.SetupGet(p => p.Draw).Returns(new Rect(1, 1, 2, 3)); gen.Object.Identifier = 'a'; floorPlan.AddHall(gen.Object); TestFloorPlan.CompareFloorPlans(floorPlan, compareFloorPlan); }
public void AddHallCollideExistingRoom() { // add on top of existing room? TestFloorPlan floorPlan = TestFloorPlan.InitFloorToContext( new Loc(22, 14), new Rect[] { new Rect(1, 1, 2, 3) }, Array.Empty <Rect>(), Array.Empty <Tuple <char, char> >()); var gen = new Mock <TestFloorPlanGen>(MockBehavior.Loose) { CallBase = true }; gen.SetupGet(p => p.Draw).Returns(new Rect(2, 2, 4, 4)); gen.Object.Identifier = 'b'; // check the rooms Assert.Throws <InvalidOperationException>(() => { floorPlan.AddHall(gen.Object); }); }