public void Test_Save_NewItem()
        {
            var repository = new Repository <TestStorable <int>, int>();
            TestStorable <int> newItemToBeSaved = new TestStorable <int> {
                Id = 1, Data = "FirstItem"
            };

            repository.Save(newItemToBeSaved);
            IEnumerable <TestStorable <int> > result = repository.GetAll();

            Assert.IsTrue((result.Contains(newItemToBeSaved)));
        }
        public void Test_Get_NonExistingId_ReturnsNull()
        {
            var repository = new Repository <TestStorable <int>, int>();

            repository.Save(new TestStorable <int> {
                Id = 1, Data = "FirstItem"
            });
            repository.Save(new TestStorable <int> {
                Id = 2, Data = "SecondItem"
            });
            repository.Save(new TestStorable <int> {
                Id = 3, Data = "ThirdItem"
            });

            TestStorable <int> result = repository.Get(4);

            Assert.AreEqual(null, result);
        }
        public void Test_Get_ByExistingId_ReturnsExpectedItem()
        {
            var repository = new Repository <TestStorable <int>, int>();

            repository.Save(new TestStorable <int> {
                Id = 1, Data = "FirstItem"
            });
            repository.Save(new TestStorable <int> {
                Id = 2, Data = "SecondItem"
            });
            repository.Save(new TestStorable <int> {
                Id = 3, Data = "ThirdItem"
            });

            TestStorable <int> result = repository.Get(2);

            Assert.AreEqual("SecondItem", result.Data);
        }
        public void Test_Save_WithExistingId_ReplacesItem()
        {
            var repository = new Repository <TestStorable <int>, int>();

            repository.Save(new TestStorable <int> {
                Id = 1, Data = "FirstItem"
            });
            repository.Save(new TestStorable <int> {
                Id = 2, Data = "SecondItem"
            });
            repository.Save(new TestStorable <int> {
                Id = 2, Data = "ThirdItem"
            });

            IEnumerable <TestStorable <int> > result = repository.GetAll();

            Assert.AreEqual(2, result.Count());

            TestStorable <int> item = repository.Get(2);

            Assert.AreEqual("ThirdItem", item.Data);
        }