From cb02fc44f5f80fce8fe9e1b87bcfa09df7960a13 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 4 Jul 2011 23:03:05 +0100 Subject: [PATCH] add TestExpireAsset() --- .../Asset/Tests/FlotsamAssetCacheTests.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index 36cffd08ad..bbe40d1fd4 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs @@ -44,6 +44,9 @@ using OpenSim.Tests.Common.Mock; namespace OpenSim.Region.CoreModules.Asset.Tests { + /// + /// At the moment we're only test the in-memory part of the FlotsamAssetCache. This is a considerable weakness. + /// [TestFixture] public class FlotsamAssetCacheTests { @@ -86,5 +89,22 @@ namespace OpenSim.Region.CoreModules.Asset.Tests Assert.That(retrievedAsset, Is.Not.Null); Assert.That(retrievedAsset.ID, Is.EqualTo(asset.ID)); } + + [Test] + public void TestExpireAsset() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + AssetBase asset = AssetHelpers.CreateAsset(); + asset.ID = TestHelper.ParseTail(0x2).ToString(); + + m_cache.Store(asset); + + m_cache.Expire(asset.ID); + + AssetBase retrievedAsset = m_cache.Get(asset.ID.ToString()); + Assert.That(retrievedAsset, Is.Null); + } } } \ No newline at end of file