예제 #1
0
        public void PossibleGhostsFromEvidence(Evidences evidences, params Ghost[] expected)
        {
            var actual = evidences.GetGhosts().ToList();

            Assert.Equal(expected.Length, actual.Count);
            Assert.Equal(expected.OrderBy(o => o), actual.OrderBy(o => o));
        }
예제 #2
0
        public void GhostsFromFoundAndEliminatedEvidence(Evidences found, Evidences eliminated, params Ghost[] expected)
        {
            var actual = found.GetGhosts(eliminated).ToList();

            Assert.Equal(expected.Length, actual.Count);
            Assert.Equal(expected.OrderBy(o => o), actual.OrderBy(o => o));
        }
예제 #3
0
        public static IEnumerable <Ghost> GetGhosts(this Evidences found, Evidences eliminated)
        {
            var left  = found.GetGhosts();
            var right = eliminated.GetEliminatedGhosts();

            return(from l in left
                   from r in right
                   where l == r
                   select l);
        }