Пример #1
0
        public void Can_remove_an_item()
        {
            var box = new Box();
            var item = new Item {Name = "Test Item"};

            box.AddItem(1, item);

            Assert.Equal(1, box.Contents.Count(x => x.Item == item));

            box.RemoveItem(item);

            Assert.Empty(box.Contents);
        }
Пример #2
0
 public void Removing_an_item_that_is_not_in_box_throws_error()
 {
     var box = new Box();
     Assert.Throws<InvalidOperationException>(() => box.RemoveItem(new Item()));
 }