Esempio n. 1
0
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        public FOV Test(string mapString, MapCoordinates location, int maxRow, int countSeen)
        {
            MemoryStream  stream     = new MemoryStream(Encoding.Default.GetBytes(mapString));
            FileExcavator excavator  = new FileExcavator(stream);
            CsRogueMap    csRogueMap = new CsRogueMap();

            excavator.Excavate(csRogueMap);

            FOV fov = new FOV(csRogueMap, maxRow);

            fov.Scan(location);
            Assert.AreEqual(countSeen, fov.NewlySeen.ToList().Count);
            return(fov);
        }
Esempio n. 2
0
        public void ExcavateTest()
        {
            const string mapString =
                @"@r-............
...............
...............
...............";
            MemoryStream  stream     = new MemoryStream(Encoding.Default.GetBytes(mapString));
            FileExcavator excavator  = new FileExcavator(stream);
            CsRogueMap    csRogueMap = new CsRogueMap();

            excavator.Excavate(csRogueMap);
            CheckLocation(csRogueMap, 0, 0, TerrainType.Floor, ItemType.Player);
            CheckLocation(csRogueMap, 1, 0, TerrainType.Floor, ItemType.Rat);
            CheckLocation(csRogueMap, 2, 0, TerrainType.HorizontalWall);
            CheckLocation(csRogueMap, 3, 0, TerrainType.Floor);
            CheckLocation(csRogueMap, 14, 0, TerrainType.Floor);
            CheckLocation(csRogueMap, 15, 0, TerrainType.OffMap);
            CheckLocation(csRogueMap, 14, 3, TerrainType.Floor);
            CheckLocation(csRogueMap, 15, 4, TerrainType.OffMap);
        }