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); }
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); }
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); }
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); }
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); }
public void AddItem_WithoutName_ShouldThrow() { CardItemCollection cardItemCollection = new CardItemCollection(); cardItemCollection.Add(new CardItem()); }