public void ReceiveBorderRange(int rangeStart, int rangeEnd, Dir4 dir, int expectedStart, int expectedEnd, bool exception) { Mock <IRandom> testRand = new Mock <IRandom>(MockBehavior.Strict); var roomGen = new TestRoomGen <ITiledGenContext>(); roomGen.PrepareSize(testRand.Object, new Loc(5, 7)); roomGen.SetLoc(new Loc(1, 2)); if (exception) { Assert.Throws <ArgumentException>(() => { roomGen.ReceiveBorderRange(new IntRange(rangeStart, rangeEnd), dir); }); } else { roomGen.ReceiveBorderRange(new IntRange(rangeStart, rangeEnd), dir); IntRange newRange = roomGen.RoomSideReqs[dir][0]; Assert.That(newRange, Is.EqualTo(new IntRange(expectedStart, expectedEnd))); } }
public void ReceiveBorderRangeToFulfill() { // test with offset, proving previous openedborders are properly transferred Mock <IRandom> testRand = new Mock <IRandom>(MockBehavior.Strict); var roomGen = new TestRoomGen <ITiledGenContext>(); roomGen.PrepareSize(testRand.Object, new Loc(5, 7)); roomGen.SetLoc(new Loc(2, 3)); roomGen.ReceiveBorderRange(new IntRange(1, 6), Dir4.Right); var expectedBorderToFulfill = new Dictionary <Dir4, bool[]> { [Dir4.Down] = new bool[] { false, false, false, false, false }, [Dir4.Left] = new bool[] { false, false, false, false, false, false, false }, [Dir4.Up] = new bool[] { false, false, false, false, false }, [Dir4.Right] = new bool[] { true, true, true, false, false, false, false }, }; Assert.That(roomGen.PublicBorderToFulfill, Is.EqualTo(expectedBorderToFulfill)); }