Exemplo n.º 1
0
        public void SequenceTripletTileGrouperCanGroupTilesIntoLegalHandMethodTest_SimpleMixedTilesAllGroups_IsTrue()
        {
            var tileSorterStub = new FakeTileSorter();
            var grouper        = new SequenceTripletTileGrouper(tileSorterStub);
            var tiles          = GetSimpleHandOfMixedTilesAllGroups();

            var result = grouper.CanGroupTilesIntoLegalHand(tiles);

            Assert.IsTrue(result);
        }
Exemplo n.º 2
0
        public void SequenceTripletTileGrouperCanGroupTilesIntoLegalHandMethodTest_SimpleHonorTilesNotGroupable_IsFalse()
        {
            var tileSorterStub = new FakeTileSorter();
            var grouper        = new SequenceTripletTileGrouper(tileSorterStub);
            var tiles          = GetSimpleHandOfHonorTilesNotFullyGroupable();

            var result = grouper.CanGroupTilesIntoLegalHand(tiles);

            Assert.IsFalse(result);
        }
Exemplo n.º 3
0
        public void SequenceTripletTileGrouperCanGroupTilesIntoLegalHandMethodTest_ComplexSuitedTilesGroupable_IsTrue()
        {
            var tileSorterStub = new FakeTileSorter();
            var grouper        = new SequenceTripletTileGrouper(tileSorterStub);
            var tiles          = GetComplexGroupableHandOfSuitedTiles();

            var result = grouper.CanGroupTilesIntoLegalHand(tiles);

            Assert.IsTrue(result);
        }
Exemplo n.º 4
0
        public void SequenceTripletTileGrouperFindAllGroupsInTilesMethodTest_ComplexSuitedTiles()
        {
            var tileSorterStub = new FakeTileSorter();
            var grouper        = new SequenceTripletTileGrouper(tileSorterStub);
            var tiles          = GetComplexGroupableHandOfSuitedTiles();

            var actual   = (List <TileGrouping>)grouper.FindAllGroupsInTiles(tiles);
            var expected = (List <TileGrouping>)GetAllGroupsFromComplexHandOfSuitedTiles();

            CollectionAssert.AreEquivalent(expected, actual);
        }
Exemplo n.º 5
0
        public void SequenceTripletTileGrouperFindAllWaysToGroupTilesMethodTest_SimpleSuitedTilesAllGroups()
        {
            var tileSorterStub = new FakeTileSorter();
            var grouper        = new SequenceTripletTileGrouper(tileSorterStub);
            var tiles          = GetSimpleHandOfSuitedTilesAllGroups();

            var actual   = (List <IList <TileGrouping> >)grouper.FindAllWaysToGroupTiles(tiles);
            var expected = (List <IList <TileGrouping> >)GetAllWaysToGroupTilesFromSimpleHandOfSuitedTilesGroups();

            Assert.AreEqual(expected.Count, actual.Count);
            foreach (var sublist in actual)
            {
                var result = expected.Any(x => x.Count == sublist.Count && x.ToHashSet().SetEquals(sublist.ToHashSet()));
                Assert.IsTrue(result);
            }
        }