예제 #1
0
        public void DeleteItemFromCacheById_Item_ItemIsNoLongerInResultSet()
        {
            PalasoTestItem itemToDelete = dataMapper.CreateItem();

            itemToDelete.StoredList = PopulateListWith("Item 5", "Item 4");
            dataMapper.SaveItem(itemToDelete);

            _results = dataMapper.GetItemsMatching(_queryToCache);
            ResultSetCache <PalasoTestItem> resultSetCacheUnderTest = new ResultSetCache <PalasoTestItem>(dataMapper, _sortDefinitions, _results, _queryToCache);

            resultSetCacheUnderTest.DeleteItemFromCache(dataMapper.GetId(itemToDelete));

            //Would be a better test but ResultSets don't support equality checks
            //Assert.AreEqual(resultsBeforeUpdate, resultsAfterUpdate);

            Assert.AreEqual(4, resultSetCacheUnderTest.GetResultSet().Count);
            Assert.AreEqual("Item 0", resultSetCacheUnderTest.GetResultSet()[0]["StoredList"]);
            Assert.AreEqual("Item 1", resultSetCacheUnderTest.GetResultSet()[1]["StoredList"]);
            Assert.AreEqual("Item 2", resultSetCacheUnderTest.GetResultSet()[2]["StoredList"]);
            Assert.AreEqual("Item 3", resultSetCacheUnderTest.GetResultSet()[3]["StoredList"]);
        }
예제 #2
0
 public RepositoryId GetId(T item)
 {
     return(_backend.GetId(item));
 }