Exemplo n.º 1
0
        public void Get_OneItemBagIsNotEmpty_ThrowsException()
        {
            var bag = new OneItemBag <object>();

            var actual = Assert.ThrowsException <OneItemBagException>(() => bag.Get());

            Assert.AreEqual("Invalid operation. Bag is empty", actual.Message);
        }
Exemplo n.º 2
0
        public void Get_OneItemBagIsEmptyAfterPullAndGet_ThrowsException()
        {
            var bag = new OneItemBag <string>();

            bag.Put("1");
            bag.Get();

            var actual = Assert.ThrowsException <OneItemBagException>(() => bag.Get());

            Assert.AreEqual("Invalid operation. Bag is empty", actual.Message);
        }
Exemplo n.º 3
0
        public void Get_OneItemBagHasAnItem_ThrowsException()
        {
            var bag = new OneItemBag <TestItem>();

            bag.Put(new TestItem {
                Id = 666, Name = "TT", Description = "1212"
            });
            TestItem actual = bag.Get();

            Assert.AreEqual(666, actual.Id);
            Assert.AreEqual("TT", actual.Name);
            Assert.AreEqual("1212", actual.Description);
        }
        public void Get_OneItemBahHasAnItem_ReturnsItem()
        {
            var bag = new OneItemBag <TestItem>();

            bag.Put(new TestItem {
                Id = 777, Name = "Test Item", Description = "Description of Test Item"
            });

            TestItem actual = bag.Get();

            Assert.AreEqual(777, actual.Id);
            Assert.AreEqual("Test Item", actual.Name);
            Assert.AreEqual("Description of Test Item", actual.Description);
        }