diff options
author | Sean Dague | 2008-09-12 18:13:43 +0000 |
---|---|---|
committer | Sean Dague | 2008-09-12 18:13:43 +0000 |
commit | 9349cf314963a2b74727b86e37b41642c7212d6d (patch) | |
tree | e52240f71b1bce3531649ce1629e1b62219f6827 /OpenSim/Data/Tests/BasicAssetTest.cs | |
parent | change order in prebuild.xml so this works in nant on a clean (diff) | |
download | opensim-SC-9349cf314963a2b74727b86e37b41642c7212d6d.zip opensim-SC-9349cf314963a2b74727b86e37b41642c7212d6d.tar.gz opensim-SC-9349cf314963a2b74727b86e37b41642c7212d6d.tar.bz2 opensim-SC-9349cf314963a2b74727b86e37b41642c7212d6d.tar.xz |
move the actual [Test] methods for databases to OpenSim.Data.Tests
classes. This did mean loosing 1 unit test that was actually testing
an sqlite function directly instead of the interface.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/Tests/BasicAssetTest.cs | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs new file mode 100644 index 0000000..1e2069f --- /dev/null +++ b/OpenSim/Data/Tests/BasicAssetTest.cs | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using NUnit.Framework; | ||
31 | using NUnit.Framework.SyntaxHelpers; | ||
32 | using OpenSim.Data; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.Environment.Scenes; | ||
35 | using OpenMetaverse; | ||
36 | |||
37 | namespace OpenSim.Data.Tests | ||
38 | { | ||
39 | public class BasicAssetTest | ||
40 | { | ||
41 | public AssetDataBase db; | ||
42 | public UUID uuid1; | ||
43 | public UUID uuid2; | ||
44 | public UUID uuid3; | ||
45 | |||
46 | public void SuperInit() | ||
47 | { | ||
48 | uuid1 = UUID.Random(); | ||
49 | uuid2 = UUID.Random(); | ||
50 | uuid3 = UUID.Random(); | ||
51 | } | ||
52 | |||
53 | [Test] | ||
54 | public void T001_LoadEmpty() | ||
55 | { | ||
56 | Assert.That(db.ExistsAsset(uuid1), Is.False); | ||
57 | Assert.That(db.ExistsAsset(uuid2), Is.False); | ||
58 | Assert.That(db.ExistsAsset(uuid3), Is.False); | ||
59 | } | ||
60 | |||
61 | [Test] | ||
62 | public void T010_StoreSimpleAsset() | ||
63 | { | ||
64 | AssetBase a1 = new AssetBase(uuid1, "asset one"); | ||
65 | AssetBase a2 = new AssetBase(uuid2, "asset two"); | ||
66 | AssetBase a3 = new AssetBase(uuid3, "asset three"); | ||
67 | db.CreateAsset(a1); | ||
68 | db.CreateAsset(a2); | ||
69 | db.CreateAsset(a3); | ||
70 | |||
71 | AssetBase a1a = db.FetchAsset(uuid1); | ||
72 | Assert.That(a1.ID.ToString(), Text.Matches(a1a.ID.ToString())); | ||
73 | Assert.That(a1.Name, Text.Matches(a1a.Name)); | ||
74 | |||
75 | AssetBase a2a = db.FetchAsset(uuid2); | ||
76 | Assert.That(a2.ID.ToString(), Text.Matches(a2a.ID.ToString())); | ||
77 | Assert.That(a2.Name, Text.Matches(a2a.Name)); | ||
78 | |||
79 | AssetBase a3a = db.FetchAsset(uuid3); | ||
80 | Assert.That(a3.ID.ToString(), Text.Matches(a3a.ID.ToString())); | ||
81 | Assert.That(a3.Name, Text.Matches(a3a.Name)); | ||
82 | } | ||
83 | |||
84 | [Test] | ||
85 | public void T011_ExistsSimpleAsset() | ||
86 | { | ||
87 | Assert.That(db.ExistsAsset(uuid1), Is.True); | ||
88 | Assert.That(db.ExistsAsset(uuid2), Is.True); | ||
89 | Assert.That(db.ExistsAsset(uuid3), Is.True); | ||
90 | } | ||
91 | |||
92 | // this has questionable use, but it is in the interface at the moment. | ||
93 | // [Test] | ||
94 | // public void T012_DeleteAsset() | ||
95 | // { | ||
96 | // db.DeleteAsset(uuid1); | ||
97 | // db.DeleteAsset(uuid2); | ||
98 | // db.DeleteAsset(uuid3); | ||
99 | // Assert.That(db.ExistsAsset(uuid1), Is.False); | ||
100 | // Assert.That(db.ExistsAsset(uuid2), Is.False); | ||
101 | // Assert.That(db.ExistsAsset(uuid3), Is.False); | ||
102 | // } | ||
103 | } | ||
104 | } \ No newline at end of file | ||