29 using NUnit.Framework;
31 using OpenSim.Tests.Common;
33 namespace OpenSim.Framework.Tests
39 private UUID cacheItemUUID;
45 cacheItemUUID = UUID.Random();
47 byte[] foo =
new byte[1];
49 cachedItem.Store(foo);
50 cache.Store(cacheItemUUID.ToString(), cachedItem);
56 byte[] data = (byte[]) citem.
Retrieve();
57 Assert.That(data.Length == 1,
"Cached Item should have one byte element");
58 Assert.That(data[0] == 255,
"Cached Item element should be 255");
64 UUID randomNotIn = UUID.Random();
65 while (randomNotIn == cacheItemUUID)
67 randomNotIn = UUID.Random();
69 object citem = cache.Get(randomNotIn.ToString());
70 Assert.That(citem == null,
"Item should not be in Cache");
77 UUID ImmediateExpiryUUID = UUID.Random();
79 byte[] foo =
new byte[1];
81 cachedItem.Store(foo);
82 cache.Store(cacheItemUUID.ToString(), cachedItem);
83 cache.Invalidate(cacheItemUUID.ToString());
84 cache.Get(cacheItemUUID.ToString());
85 object citem = cache.Get(cacheItemUUID.ToString());
86 Assert.That(citem == null,
"Item should not be in Cache because we manually invalidated it");
92 UUID ImmediateExpiryUUID = UUID.Random();
94 byte[] foo =
new byte[1];
96 cachedItem.Store(foo);
97 cache.Store(cacheItemUUID.ToString(), cachedItem);
100 object citem = cache.Get(cacheItemUUID.ToString());
101 Assert.That(citem == null,
"Item should not be in Cache because we manually invalidated it");
107 UUID Random1 = UUID.Random();
108 UUID Random2 = UUID.Random();
109 byte[] data =
new byte[0];
116 Assert.That(cb1.Equals(cb3),
"cb1 should equal cb3, their uuids are the same");
117 Assert.That(!cb2.Equals(cb1),
"cb2 should not equal cb1, their uuids are NOT the same");
118 Assert.That(cb1.IsLocked() ==
false,
"CacheItemBase default is false");
119 Assert.That(cb1.Retrieve() == null,
"Virtual Retrieve method should return null");
void ExpireItemManually()
virtual Object Retrieve()