Beispiel #1
0
        public void TestMethodPutGet()
        {
            TestPerson person = new TestPerson("SomeNickname", "Иванов И.И.");

            cache.Put(person.NickName, person);
            Assert.That(cache.Get("SomeNickname").Equals(person));
        }
Beispiel #2
0
        public void TestMethodDelResentAdded()
        {
            ICacheChangeAlgorithm algo         = new MRUreplacementAlgorithm();
            NWayAssociateSetChach cache        = new NWayAssociateSetChach(algo, 4, 2);
            TestPerson            personIvanov = new TestPerson("ivanov", "Иванов И.И.");

            cache.Put(personIvanov.NickName, personIvanov);
            System.Threading.Thread.Sleep(50);
            TestPerson personPetrov = new TestPerson("petrov", "Петров П.П.");

            cache.Put(personPetrov.NickName, personPetrov);
            System.Threading.Thread.Sleep(50);
            TestPerson personSidorov = new TestPerson("sidorov", "Сидоров П.П.");

            cache.Put(personSidorov.NickName, personSidorov);
            Assert.That(cache.Get("ivanov").Equals(personIvanov));
            Assert.That(cache.Get("petrov") == null);
            Assert.That(cache.Get("sidorov").Equals(personSidorov));
        }