コード例 #1
0
        public void AddItem_ShouldSetPosition()
        {
            CardItemCollection cardItemCollection = new CardItemCollection();
            CardItem           item1 = new CardItem {
                Name = "test 01"
            };
            CardItem item2 = new CardItem {
                Name = "test 02"
            };

            cardItemCollection.Add(item1);
            cardItemCollection.Add(item2);
            Assert.AreEqual(1, item1.Position);
            Assert.AreEqual(2, item2.Position);
        }
コード例 #2
0
        public void MoveDown_OnLastItem_ShouldIgnore()
        {
            CardItemCollection cardItemCollection = new CardItemCollection();
            CardItem           cardItem           = new CardItem {
                Name = "test"
            };

            cardItemCollection.Add(cardItem);
            cardItemCollection.MoveDown(cardItem);
            Assert.AreEqual(1, cardItem.Position);
        }
コード例 #3
0
        public void MoveUp_OnFirstItem_ShouldIgnore()
        {
            CardItemCollection cardItemCollection = new CardItemCollection();
            CardItem           item = new CardItem {
                Name = "test"
            };

            cardItemCollection.Add(item);
            cardItemCollection.MoveUp(item);
            Assert.AreEqual(1, item.Position);
        }
コード例 #4
0
        public void MoveDown_OnSecondItem_ShouldMove()
        {
            CardItemCollection cardItemCollection = new CardItemCollection();
            CardItem           item1 = new CardItem {
                Name = "test 01"
            };
            CardItem item2 = new CardItem {
                Name = "test 02"
            };
            CardItem item3 = new CardItem {
                Name = "test 03"
            };

            cardItemCollection.Add(item1);
            cardItemCollection.Add(item2);
            cardItemCollection.Add(item3);
            cardItemCollection.MoveDown(item2);
            Assert.AreEqual(1, item1.Position);
            Assert.AreEqual(3, item2.Position);
            Assert.AreEqual(2, item3.Position);
        }
コード例 #5
0
        public void RemoveItem_ShouldRecalcPositions()
        {
            CardItemCollection cardItemCollection = new CardItemCollection();
            CardItem           item1 = new CardItem {
                Name = "test 01"
            };
            CardItem item2 = new CardItem {
                Name = "test 02"
            };
            CardItem item3 = new CardItem {
                Name = "test 03"
            };

            cardItemCollection.Add(item1);
            cardItemCollection.Add(item2);
            cardItemCollection.Add(item3);

            cardItemCollection.Remove(item2);

            Assert.AreEqual(1, item1.Position);
            Assert.AreEqual(2, item3.Position);
        }
コード例 #6
0
        public void AddItem_WithoutName_ShouldThrow()
        {
            CardItemCollection cardItemCollection = new CardItemCollection();

            cardItemCollection.Add(new CardItem());
        }