Ejemplo n.º 1
0
        public void GetMatchingTilesTest()
        {
            Tile tile123 = new Tile(0, 0);
            tile123.SetPossibleAnswers(new List<int>() { 1, 2 });

            Tile tileMatch123 = new Tile(1, 0);
            tileMatch123.SetPossibleAnswers(new List<int>() { 1, 2 });

            Tile tile456 = new Tile(3, 0);
            tile456.SetPossibleAnswers(new List<int>() { 4, 5 });

            Tile tileMatch456 = new Tile(4, 0);
            tileMatch456.SetPossibleAnswers(new List<int>() { 4, 5 });

            Tile tile567 = new Tile(6, 0);
            tile567.SetPossibleAnswers(new List<int>() { 1, 2, 5, 6, 7 });

            List<Tile> allTiles = new List<Tile>() { tile123, tileMatch123, tile456, tileMatch456, tile567 };

            SubgroupReductionStrategy_Accessor accessor = new SubgroupReductionStrategy_Accessor();
            List<Tile> actual = accessor.GetMatchingTiles(allTiles);
            Assert.AreEqual(4, actual.Count);
            accessor.RemoveSubgroup(allTiles, actual);
            Assert.AreEqual(2, tile567.GetPossibleAnswers().Count);
        }
Ejemplo n.º 2
0
        public void GetMatchingTilesTest()
        {
            Tile tile123 = new Tile(0, 0);

            tile123.SetPossibleAnswers(new List <int>()
            {
                1, 2
            });

            Tile tileMatch123 = new Tile(1, 0);

            tileMatch123.SetPossibleAnswers(new List <int>()
            {
                1, 2
            });

            Tile tile456 = new Tile(3, 0);

            tile456.SetPossibleAnswers(new List <int>()
            {
                4, 5
            });

            Tile tileMatch456 = new Tile(4, 0);

            tileMatch456.SetPossibleAnswers(new List <int>()
            {
                4, 5
            });

            Tile tile567 = new Tile(6, 0);

            tile567.SetPossibleAnswers(new List <int>()
            {
                1, 2, 5, 6, 7
            });

            List <Tile> allTiles = new List <Tile>()
            {
                tile123, tileMatch123, tile456, tileMatch456, tile567
            };

            SubgroupReductionStrategy_Accessor accessor = new SubgroupReductionStrategy_Accessor();
            List <Tile> actual = accessor.GetMatchingTiles(allTiles);

            Assert.AreEqual(4, actual.Count);
            accessor.RemoveSubgroup(allTiles, actual);
            Assert.AreEqual(2, tile567.GetPossibleAnswers().Count);
        }