Exemple #1
0
 public void SpyCardConstructorTest()
 {
     Player playerShowingCard = new Player("player");
     Card cardSeen = new Weapon("card");
     SpyCard target = new SpyCard(playerShowingCard, cardSeen);
     Assert.AreSame(playerShowingCard, target.Player);
     Assert.AreSame(cardSeen, target.Card);
 }
Exemple #2
0
 public void GetContraintsMissingNodesTest()
 {
     Player playerShowingCard = new Player("test");
     Card cardSeen = new Weapon("test");
     Card anotherCard = new Suspect("test");
     Node[] nodes = new Node[] {
                        new Node(playerShowingCard, cardSeen),
                        new Node(playerShowingCard, anotherCard),
                    };
     new SpyCard(playerShowingCard, cardSeen).GetConstraints(nodes.Where((n, i) => i == 1)).Count();
 }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Suspicion"/> class.
        /// </summary>
        /// <param name="suspect">The suspect.</param>
        /// <param name="weapon">The weapon.</param>
        /// <param name="place">The place.</param>
        public Suspicion(Suspect suspect, Weapon weapon, Place place)
        {
            Contract.Requires<ArgumentNullException>(suspect != null, "suspect");
            Contract.Requires<ArgumentNullException>(weapon != null, "weapon");
            Contract.Requires<ArgumentNullException>(place != null, "place");

            this.suspect = suspect;
            this.weapon = weapon;
            this.place = place;

            Contract.Assume(this.Cards.Count() == 3);
        }
Exemple #4
0
 public void CardsTest()
 {
     var w = new Weapon("weapon");
     var s = new Suspect("suspect");
     var l = new Place("location");
     Suspicion target = new Suspicion(s, w, l);
     List<Card> cards = target.Cards.ToList();
     CollectionAssert.Contains(cards, w);
     CollectionAssert.Contains(cards, s);
     CollectionAssert.Contains(cards, l);
     Assert.AreEqual(3, cards.Count);
 }
Exemple #5
0
 public void GetConstraintsTest()
 {
     Player playerShowingCard = new Player("test");
     Card cardSeen = new Weapon("test");
     Card anotherCard = new Suspect("test");
     Node[] nodes = new Node[] {
                        new Node(playerShowingCard, cardSeen),
                        new Node(playerShowingCard, anotherCard),
                    };
     SpyCard target = new SpyCard(playerShowingCard, cardSeen);
     var actual = target.GetConstraints(nodes);
     Assert.AreEqual(1, actual.Count());
     SelectionCountConstraint c = actual.First() as SelectionCountConstraint;
     Assert.IsNotNull(c);
     Assert.AreEqual(1, c.Min);
     Assert.AreEqual(1, c.Max);
     Assert.AreEqual(1, c.Nodes.Count());
     Assert.AreSame(nodes[0], c.Nodes.First());
 }
Exemple #6
0
 public void WeaponConstructorTest()
 {
     const string name = "Test";
     Card c = new Weapon(name);
     Assert.AreEqual(name, c.Name);
 }