public void Setup() { _repository = new MemoryRepository<TestItem>(); PopulateRepositoryWithItemsForQuerying(_repository); _queryToCache = new QueryAdapter<TestItem>(); _queryToCache.Show("StoredString"); _results = _repository.GetItemsMatching(_queryToCache); _sortDefinitions = new SortDefinition[1]; _sortDefinitions[0] = new SortDefinition("StoredString", Comparer<string>.Default); }
public void Setup() { _dataMapper = new MemoryDataMapper <PalasoTestItem>(); PopulateRepositoryWithItemsForQuerying(_dataMapper); _queryToCache = new QueryAdapter <PalasoTestItem>(); _queryToCache.Show("StoredString"); _results = _dataMapper.GetItemsMatching(_queryToCache); _sortDefinitions = new SortDefinition[1]; _sortDefinitions[0] = new SortDefinition("StoredString", Comparer <string> .Default); }
public void ResultSetContainsIdenticalRecordTokens_Throws() { PalasoTestItem itemFromWhichToCreateIdenticalRecordTokens = dataMapper.CreateItem(); itemFromWhichToCreateIdenticalRecordTokens.StoredString = "Get me twice!"; QueryAdapter <PalasoTestItem> query1 = new QueryAdapter <PalasoTestItem>(); query1.Show("StoredString"); QueryAdapter <PalasoTestItem> query2 = new QueryAdapter <PalasoTestItem>(); query2.Show("StoredString"); ResultSetCache <PalasoTestItem> resultSetCacheUnderTest = new ResultSetCache <PalasoTestItem>(dataMapper, _sortDefinitions); resultSetCacheUnderTest.Add(dataMapper.GetItemsMatching(query1), query1); Assert.Throws <ArgumentException>(() => resultSetCacheUnderTest.Add(dataMapper.GetItemsMatching(query2), query2)); }
public void ResultSetContainsIdenticalRecordTokens_Throws() { TestItem itemFromWhichToCreateIdenticalRecordTokens = _repository.CreateItem(); itemFromWhichToCreateIdenticalRecordTokens.StoredString = "Get me twice!"; QueryAdapter<TestItem> query1 = new QueryAdapter<TestItem>(); query1.Show("StoredString"); QueryAdapter<TestItem> query2 = new QueryAdapter<TestItem>(); query2.Show("StoredString"); ResultSetCache<TestItem> resultSetCacheUnderTest = new ResultSetCache<TestItem>(_repository, _sortDefinitions); resultSetCacheUnderTest.Add(_repository.GetItemsMatching(query1), query1); resultSetCacheUnderTest.Add(_repository.GetItemsMatching(query2), query2); }