From e2b1fb8ff9242b112232446eee4642a2f090f0e3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 12 Nov 2009 19:15:08 +0000 Subject: refactor: extract another test asset helper method --- OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | 7 +++---- OpenSim/Tests/Common/Setup/AssetHelpers.cs | 13 +++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index dc98550..b68a044 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -34,6 +34,7 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Setup; using OpenSim.Tests.Common.Mock; namespace OpenSim.Region.Framework.Scenes.Tests @@ -55,11 +56,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestCorruptAsset() { TestHelper.InMethod(); - + UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); - AssetBase corruptAsset = new AssetBase(corruptAssetUuid, corruptAssetUuid.ToString(), (sbyte)AssetType.Object); - corruptAsset.Data = Encoding.ASCII.GetBytes("CORRUPT ASSET"); - + AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET"); m_assetService.Store(corruptAsset); IDictionary foundAssetUuids = new Dictionary(); diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs index 3b3babe..df69cd9 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs @@ -36,6 +36,19 @@ namespace OpenSim.Tests.Common public class AssetHelpers { /// + /// Create an asset from the given data + /// + /// + /// + /// + public static AssetBase CreateAsset(UUID assetUuid, string data) + { + AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object); + asset.Data = Encoding.ASCII.GetBytes(data); + return asset; + } + + /// /// Create an asset from the given scene object /// /// -- cgit v1.1