Example #1
0
        public void GetCollectionGetsObjectsOfType()
        {
            var index   = new IndexStore("GetAll");
            var fs      = new FileDataStore("GetAll", index);
            var journal = new FileJournal("GetAll", fs);
            var store   = new InMemoryDataStore(fs, journal.DirectoryPath);

            try
            {
                var sword  = new Sword("Lego Sword", 13);
                var katana = new Sword("Lego Katana", 27);

                store.PutObject(sword, 1);
                store.PutObject(katana, 2);
                store.PutObject(new Car("Kia", "Aieeee", "Black"), 3);

                var actual = store.GetCollection <Sword>();
                Assert.AreEqual(2, actual.Count);
                Assert.AreEqual(sword, actual.ElementAt(0));
                Assert.AreEqual(katana, actual.ElementAt(1));
            }
            finally
            {
                Directory.Delete("GetAll", true);
            }
        }
Example #2
0
 public List <T> GetCollection <T>()
 {
     return(memoryStore.GetCollection <T>());
 }