Beispiel #1
0
        public void Can_fetch_the_oldest_element_of_a_spesific_location_in_the_cache()
        {
            var type  = DefinitionCacheItemType.Script;
            var cache = new DefinitionCache();

            cache
            .Add(type, "loc1", DateTime.Now, false, true, "cmd1", "")
            .Append(type, "loc1", DateTime.Now, false, true, "cmd2", "")
            .Append(type, "loc1", new DateTime(2012, 10, 1, 0, 0, 0), false, true, "cmd3", "")
            .Append(type, "loc2", new DateTime(2012, 1, 1, 0, 0, 0), false, false, "-g", "");
            Assert.That(cache.GetOldestItem("loc1").Name, Is.EqualTo("cmd3"));
        }
Beispiel #2
0
        public void Can_fetch_the_oldest_element_in_the_cache()
        {
            var type  = DefinitionCacheItemType.Script;
            var time  = new DateTime(2012, 1, 1, 0, 0, 0);
            var cache = new DefinitionCache();

            cache
            .Add(type, "", DateTime.Now, false, true, "cmd1", "")
            .Append(type, "", DateTime.Now, false, true, "cmd2", "")
            .Append(type, "", DateTime.Now, false, true, "cmd3", "")
            .Append(type, "", time, false, false, "-g", "");
            cache
            .Add(type, "", DateTime.Now, false, true, "cmd1-1", "")
            .Append(type, "", DateTime.Now, false, true, "cmdAnother", "");
            Assert.That(cache.GetOldestItem().Name, Is.EqualTo("-g"));
        }