コード例 #1
0
ファイル: CardTests.cs プロジェクト: pleonex/deblocus
        public void IsCompleted()
        {
            Card card = new Card();
            while (card.GroupId < Card.PointsForComplete) {
                Assert.IsFalse(card.IsComplete());
                card.GivePoint();
            }

            Assert.IsTrue(card.IsComplete());

            card.GivePoint();
            Assert.IsTrue(card.IsComplete());
        }
コード例 #2
0
ファイル: CardTests.cs プロジェクト: pleonex/deblocus
        public void ResetPoints()
        {
            Card card = new Card();
            Assert.DoesNotThrow(card.ResetPoints);
            Assert.AreEqual(0, card.Points);
            Assert.AreEqual(0, card.GroupId);

            while (card.GroupId == 0)
                card.GivePoint();
            var cardDate = card.GroupChangeDate;

            card.ResetPoints();
            Assert.AreEqual(0, card.Points);
            Assert.AreEqual(0, card.GroupId);
            Assert.AreNotEqual(cardDate, card.GroupChangeDate);
        }
コード例 #3
0
ファイル: CardTests.cs プロジェクト: pleonex/deblocus
        public void GivePoint()
        {
            Card card = new Card { TargetPoints = 2 };
            DateTime initialDate = card.GroupChangeDate;

            Assert.AreEqual(0, card.Points);
            Assert.AreEqual(0, card.GroupId);
            Assert.AreEqual(initialDate, card.GroupChangeDate);

            card.GivePoint();
            Assert.AreEqual(1, card.Points);
            Assert.AreEqual(0, card.GroupId);
            Assert.AreEqual(initialDate, card.GroupChangeDate);

            card.GivePoint();
            Assert.AreEqual(0, card.Points);
            Assert.AreEqual(1, card.GroupId);
            Assert.Greater(card.GroupChangeDate, initialDate);
        }