diff options
Diffstat (limited to 'OpenSim/Tests/Common/Mock/BaseAssetRepository.cs')
-rw-r--r-- | OpenSim/Tests/Common/Mock/BaseAssetRepository.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs b/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs new file mode 100644 index 0000000..acfe4fe --- /dev/null +++ b/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs | |||
@@ -0,0 +1,34 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using OpenMetaverse; | ||
3 | using OpenSim.Framework; | ||
4 | |||
5 | namespace OpenSim.Tests.Common.Mock | ||
6 | { | ||
7 | public class BaseAssetRepository | ||
8 | { | ||
9 | protected Dictionary<UUID, AssetBase> Assets = new Dictionary<UUID, AssetBase>(); | ||
10 | |||
11 | public AssetBase FetchAsset(UUID uuid) | ||
12 | { | ||
13 | if (ExistsAsset(uuid)) | ||
14 | return Assets[uuid]; | ||
15 | else | ||
16 | return null; | ||
17 | } | ||
18 | |||
19 | public void CreateAsset(AssetBase asset) | ||
20 | { | ||
21 | Assets[asset.FullID] = asset; | ||
22 | } | ||
23 | |||
24 | public void UpdateAsset(AssetBase asset) | ||
25 | { | ||
26 | CreateAsset(asset); | ||
27 | } | ||
28 | |||
29 | public bool ExistsAsset(UUID uuid) | ||
30 | { | ||
31 | return Assets.ContainsKey(uuid); | ||
32 | } | ||
33 | } | ||
34 | } \ No newline at end of file | ||