public void TryRemove_WhenTableConfiguredAndEntryNotPresent_ReturnsFalse() { var database = Fake.Database(true); var result = database.TryRemove <int, Person>(1); Assert.IsFalse(result); }
public void TryAddOrUpdate_WhenTableConfigured_ReturnsTrue() { var database = Fake.Database(true); var result = database.TryAddOrUpdate(1, new Person()); Assert.IsTrue(result); }
public void TryRemoveTable_WhenTableConfigured_ReducesTableCachedCountByOne() { var database = Fake.Database(true, true); database.TryRemoveTable <Person>(); Assert.AreEqual(1, database.TotalTablesCount); }
public void SubmittingEntry_ToTheCache_IncreasesCacheCountByOne() { var database = Fake.Database(true); var people = new PersonRepository(); var person = people.GetSingle(1); database.TryAddOrUpdate(1, person); Assert.AreEqual(1, database.TableItemsCachedCount <Person>()); Assert.AreEqual(0, database.TableItemsCachedCount <Role>()); }
public void SubmittingCrossTypeEntries_ToTheCache_IncreasesCacheCountByTwo() { var database = Fake.Database(); var people = new PersonRepository(); var roles = new RoleRepository(); var person = people.GetSingle(1); var role = roles.GetSingle(1); database.AddOrUpdate(1, person, people.GetSingle); database.AddOrUpdate(1, role, roles.GetSingle); Assert.AreEqual(1, database.TableItemsCachedCount <Person>()); Assert.AreEqual(1, database.TableItemsCachedCount <Role>()); }
public void Clear_WhenRecordsCached_ClearsAll() { var database = Fake.Database(true, true); database.TryGet <int, Person>(1, out _); database.TryGet <int, Person>(2, out _); database.TryGet <int, Role>(1, out _); database.TryGet <int, Role>(2, out _); database.Clear(); Assert.AreEqual(0, database.TableItemsCachedCount <Person>()); Assert.AreEqual(0, database.TableItemsCachedCount <Role>()); Assert.AreEqual(0, database.TotalTablesCount); }
public void EagerAddingTwoTables_WhenThereAreNoTables_SetsTableCountToTwo() { var database = Fake.Database(true, true); Assert.AreEqual(2, database.TotalTablesCount); }