public static void InsertTestItems(TestDbContext context)
        {
            var item1 = new Item { Name = "Test Item 1", Description = "Test Item 1" };
            var item2 = new Item { Name = "Test Item 2", Description = "Test Item 2" };

            context.Set<Item>().Add(item1);
            context.Set<Item>().Add(item2);
        }
        public void InMemoryRepository_GetById_Returns_New_Item_When_Not_Found()
        {
            AddItems(2);

            var expectedItem = new Item();
            var result = _repository.GetById(3);
            Assert.IsNotNull(result);

            Assert.AreEqual(expectedItem.Id, result.Id);
            Assert.AreEqual(expectedItem.Uid, result.Uid);
            Assert.AreEqual(expectedItem.Name, result.Name);
            Assert.AreEqual(expectedItem.Description, result.Description);
            Assert.AreEqual(expectedItem.UserName, result.UserName);
        }
        private void AddItems(int numberOfItemsToAdd)
        {
            for (var i = 1; i < numberOfItemsToAdd + 1; i++)
            {
                var product = new Item()
                                  {
                                      Name = string.Format("Name_{0}", i),
                                      Description = string.Format("Description_{0}", i),
                                      UserName = string.Format("UserName_{0}", i)
                                  };

                _repository.SaveOrUpdate(product);

                //GenericFluentFactory<Item>
                //    .Init(product, _repository)
                //    .SaveOrUpdate();
            }
        }
        private Item AddExpectedItem()
        {
            var expectedItem = new Item()
                                   {
                                       Name = string.Format("Name_{0}", "Test"),
                                       Description = string.Format("Description_{0}", "Test"),
                                       UserName = string.Format("UserName_{0}", "Test")
                                   };

            expectedItem = _repository.SaveOrUpdate(expectedItem);
            return expectedItem;
        }
 private static void AssertResult(Item expected, Item result)
 {
     Assert.IsNotNull(result);
     Assert.AreEqual(expected, result);
     Assert.AreEqual(expected.Id, result.Id);
     Assert.AreEqual(expected.Uid, result.Uid);
     Assert.AreEqual(expected.Name, result.Name);
     Assert.AreEqual(expected.Description, result.Description);
     Assert.AreEqual(expected.UserName, result.UserName);
 }