public void TestCase() { TestStorable ts1 = new TestStorable ("first"); fs.Store<TestStorable> (ts1); List<TestStorable> lts = fs.RetrieveAll<TestStorable> (); // Check that we have stored one object Assert.AreEqual (lts.Count, 1); TestStorable ts2 = lts [0]; Assert.AreNotSame (ts2, null); // Check that the object is the same Assert.AreEqual (ts2.memberString, ts1.memberString); // Get based on memberString Dictionary<string, object> dict = new Dictionary<string, object> (); dict.Add ("memberString", "first"); lts = fs.Retrieve<TestStorable> (dict); // Check that we have stored one object Assert.AreEqual (lts.Count, 1); // Check that the returned object is the one we are looking for ts2 = lts [0]; Assert.AreNotSame (ts2, null); // Check that the storage is empty fs.Delete<TestStorable> (ts2); lts = fs.RetrieveAll<TestStorable> (); Assert.AreEqual (lts.Count, 0); }
public void TestCase() { TestStorable ts1 = new TestStorable("first"); fs.Store <TestStorable> (ts1); List <TestStorable> lts = fs.RetrieveAll <TestStorable> (); // Check that we have stored one object Assert.AreEqual(lts.Count, 1); TestStorable ts2 = lts [0]; Assert.AreNotSame(ts2, null); // Check that the object is the same Assert.AreEqual(ts2.memberString, ts1.memberString); // Get based on memberString Dictionary <string, object> dict = new Dictionary <string, object> (); dict.Add("memberString", "first"); lts = fs.Retrieve <TestStorable> (dict); // Check that we have stored one object Assert.AreEqual(lts.Count, 1); // Check that the returned object is the one we are looking for ts2 = lts [0]; Assert.AreNotSame(ts2, null); // Check that the storage is empty fs.Delete <TestStorable> (ts2); lts = fs.RetrieveAll <TestStorable> (); Assert.AreEqual(lts.Count, 0); }
public void TestRetrieveByID() { TestStorable ts1 = new TestStorable("first"); fs.Store <TestStorable> (ts1); TestStorable ts2 = fs.Retrieve <TestStorable> (ts1.ID); Assert.IsNotNull(ts2); Assert.AreEqual(ts1.ID, ts2.ID); Assert.IsNull(fs.Retrieve <TestStorable> (Guid.NewGuid())); }
public void TestRetrieveFiltered() { TestStorable ts1 = new TestStorable("first"); fs.Store <TestStorable> (ts1); /* Test with a dictionary combination that exists */ Dictionary <string, object> dict = new Dictionary <string, object> (); dict.Add("memberString", "first"); Assert.AreEqual(1, fs.Retrieve <TestStorable> (dict).Count); /* Test with a dictionary combination that doesn't exist */ dict ["memberString"] = "second"; Assert.AreEqual(0, fs.Retrieve <TestStorable> (dict).Count); }
public void TestRetrieveByID() { TestStorable ts1 = new TestStorable ("first"); fs.Store<TestStorable> (ts1); TestStorable ts2 = fs.Retrieve<TestStorable> (ts1.ID); Assert.IsNotNull (ts2); Assert.AreEqual (ts1.ID, ts2.ID); Assert.IsNull (fs.Retrieve<TestStorable> (Guid.NewGuid ())); }
public void TestRetrieveFiltered() { TestStorable ts1 = new TestStorable ("first"); fs.Store<TestStorable> (ts1); /* Test with a dictionary combination that exists */ Dictionary<string, object> dict = new Dictionary<string, object> (); dict.Add ("memberString", "first"); Assert.AreEqual (1, fs.Retrieve<TestStorable> (dict).Count); /* Test with a dictionary combination that doesn't exist */ dict ["memberString"] = "second"; Assert.AreEqual (0, fs.Retrieve<TestStorable> (dict).Count); }