public void GetValueList_AfterAddingCoupleOfObjects_ShouldReturnCountOfAddedObjects() { // Arrange var lifeTimeStorage = new LifeTimeStorage <string>(_log, "TEST", 10, 0); // Act lifeTimeStorage.Put("test_key", "test_tag"); lifeTimeStorage.Put("test_key2", "test_tag2"); lifeTimeStorage.Put("test_key2", "test_tag2"); var listOfStoredObjects = lifeTimeStorage.GetValueList(); // Assert Assert.IsTrue(listOfStoredObjects.Count == 2); lifeTimeStorage.Clear(); }
public void Clear_AfterDroppingDatabaseEntites_ShouldReturnTrue() { // Arrange var lifeTimeStorage = new LifeTimeStorage <string>(_log, "TEST", 10, 0); // Act lifeTimeStorage.Put("test_key", "test_tag"); lifeTimeStorage.Put("test_key2", "test_tag2"); lifeTimeStorage.Put("test_key2", "test_tag2"); lifeTimeStorage.Clear(); var listOfStoredObjects = lifeTimeStorage.GetValueList(); // Assert Assert.IsTrue(listOfStoredObjects.Count == 0); lifeTimeStorage.Clear(); }
public void Put_CoupleOfItemsAtOnce_ShouldReturnCountEqualZero() { // Arrange var lifeTimeStorage = new LifeTimeStorage <string>(_log, "TEST", 10, 1); // Act lifeTimeStorage.Put("test_key", "test_tag"); lifeTimeStorage.Put("test_key2", "test_tag2"); lifeTimeStorage.Put("test_key3", "test_tag3"); lifeTimeStorage.Put("test_key4", "test_tag4"); lifeTimeStorage.Put("test_key5", "test_tag5"); lifeTimeStorage.Put("test_key6", "test_tag6"); Thread.Sleep(2000); var listOfStoredObjects = lifeTimeStorage.GetValueList(); // Assert Assert.IsTrue(listOfStoredObjects.Count == 0); lifeTimeStorage.Clear(); lifeTimeStorage.RemoveJobs(); }
public void Put_ThreeItemsAndSetDestroyingObjectAfterEachSecond_ShouldReturnTrue() { // Arrange var lifeTimeStorage = new LifeTimeStorage <string>(_log, "TEST", 10, 1); // Act lifeTimeStorage.Put("test_key", "test_tag"); Thread.Sleep(1000); lifeTimeStorage.Put("test_key2", "test_tag2"); Thread.Sleep(1000); lifeTimeStorage.Put("test_key2", "test_tag2"); Thread.Sleep(1000); var listOfStoredObjects = lifeTimeStorage.GetValueList(); // Assert Assert.IsTrue(listOfStoredObjects.Count == 0); lifeTimeStorage.Clear(); lifeTimeStorage.RemoveJobs(); }