Ejemplo n.º 1
0
        public void FindApartmentMethodOne()
        {
            List <Dictionary <string, bool> > blocks = new List <Dictionary <string, bool> >();

            blocks.Insert(0, new Dictionary <string, bool>());
            blocks[0]["gym"]    = false;
            blocks[0]["school"] = true;
            blocks[0]["store"]  = false;

            blocks.Insert(1, new Dictionary <string, bool>());
            blocks[1]["gym"]    = true;
            blocks[1]["school"] = false;
            blocks[1]["store"]  = false;

            blocks.Insert(2, new Dictionary <string, bool>());
            blocks[2]["gym"]    = true;
            blocks[2]["school"] = true;
            blocks[2]["store"]  = false;

            blocks.Insert(3, new Dictionary <string, bool>());
            blocks[3]["gym"]    = false;
            blocks[3]["school"] = true;
            blocks[3]["store"]  = false;

            blocks.Insert(4, new Dictionary <string, bool>());
            blocks[4]["gym"]    = false;
            blocks[4]["school"] = true;
            blocks[4]["store"]  = true;

            string[] reqs     = new string[] { "gym", "school", "store" };
            int      expected = 3;
            int      actual   = Apartment.FindMethodOne(blocks, reqs);

            Assert.AreEqual(expected, actual);
        }