Ejemplo n.º 1
0
        public void TestPatternFactory()
        {
            List <BasePattern> patterns = new List <BasePattern>();

            Assert.AreEqual(patterns.Count, 0);

            patterns = MatchingPatternFactory.GetSortedPatterns();
            Assert.IsNotNull(patterns);
            Assert.AreEqual(patterns.Count, 5);

            foreach (BasePattern p in patterns)
            {
                Assert.IsNotNull(p);
            }

            patterns.Clear();
            Assert.AreEqual(patterns.Count, 0);
            patterns = MatchingPatternFactory.GetSortedPatterns(typeof(Adult));
            Assert.IsNotNull(patterns);
            Assert.AreEqual(patterns.Count, 4);

            foreach (BasePattern p in patterns)
            {
                Assert.IsNotNull(p);
            }

            patterns.Clear();
            Assert.AreEqual(patterns.Count, 0);
            patterns = MatchingPatternFactory.GetSortedPatterns(typeof(Child));
            Assert.IsNotNull(patterns);
            Assert.AreEqual(patterns.Count, 4);

            foreach (BasePattern p in patterns)
            {
                Assert.IsNotNull(p);
            }
        }
Ejemplo n.º 2
0
 public MatchMaker()
 {
     Matches          = new List <MatchResult>();
     Persons          = new List <Person>();
     MatchingPatterns = MatchingPatternFactory.GetSortedPatterns();
 }