aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/Tests/SQLiteAssetTest.cs
diff options
context:
space:
mode:
authorSean Dague2008-09-12 18:13:43 +0000
committerSean Dague2008-09-12 18:13:43 +0000
commit9349cf314963a2b74727b86e37b41642c7212d6d (patch)
treee52240f71b1bce3531649ce1629e1b62219f6827 /OpenSim/Data/SQLite/Tests/SQLiteAssetTest.cs
parentchange order in prebuild.xml so this works in nant on a clean (diff)
downloadopensim-SC_OLD-9349cf314963a2b74727b86e37b41642c7212d6d.zip
opensim-SC_OLD-9349cf314963a2b74727b86e37b41642c7212d6d.tar.gz
opensim-SC_OLD-9349cf314963a2b74727b86e37b41642c7212d6d.tar.bz2
opensim-SC_OLD-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 'OpenSim/Data/SQLite/Tests/SQLiteAssetTest.cs')
-rw-r--r--OpenSim/Data/SQLite/Tests/SQLiteAssetTest.cs63
1 files changed, 3 insertions, 60 deletions
diff --git a/OpenSim/Data/SQLite/Tests/SQLiteAssetTest.cs b/OpenSim/Data/SQLite/Tests/SQLiteAssetTest.cs
index b88e29a..b399543 100644
--- a/OpenSim/Data/SQLite/Tests/SQLiteAssetTest.cs
+++ b/OpenSim/Data/SQLite/Tests/SQLiteAssetTest.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers; 31using NUnit.Framework.SyntaxHelpers;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Data.Tests;
33using OpenSim.Data.SQLite; 34using OpenSim.Data.SQLite;
34using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
35using OpenMetaverse; 36using OpenMetaverse;
@@ -37,26 +38,19 @@ using OpenMetaverse;
37namespace OpenSim.Data.SQLite.Tests 38namespace OpenSim.Data.SQLite.Tests
38{ 39{
39 [TestFixture] 40 [TestFixture]
40 public class SQLiteAssetTest 41 public class SQLiteAssetTest : BasicAssetTest
41 { 42 {
42 public string file = "assettest.db"; 43 public string file = "assettest.db";
43 public string connect; 44 public string connect;
44 public SQLiteAssetData db;
45 public UUID uuid1;
46 public UUID uuid2;
47 public UUID uuid3;
48
49 45
50 [TestFixtureSetUp] 46 [TestFixtureSetUp]
51 public void Init() 47 public void Init()
52 { 48 {
49 SuperInit();
53 System.Console.WriteLine("SQLiteAssetTest"); 50 System.Console.WriteLine("SQLiteAssetTest");
54 connect = "URI=file:" + file + ",version=3"; 51 connect = "URI=file:" + file + ",version=3";
55 db = new SQLiteAssetData(); 52 db = new SQLiteAssetData();
56 db.Initialise(connect); 53 db.Initialise(connect);
57 uuid1 = UUID.Random();
58 uuid2 = UUID.Random();
59 uuid3 = UUID.Random();
60 } 54 }
61 55
62 [TestFixtureTearDown] 56 [TestFixtureTearDown]
@@ -64,56 +58,5 @@ namespace OpenSim.Data.SQLite.Tests
64 { 58 {
65 System.IO.File.Delete(file); 59 System.IO.File.Delete(file);
66 } 60 }
67
68 [Test]
69 public void T001_LoadEmpty()
70 {
71 Assert.That(db.ExistsAsset(uuid1), Is.False);
72 Assert.That(db.ExistsAsset(uuid2), Is.False);
73 Assert.That(db.ExistsAsset(uuid3), Is.False);
74 }
75
76 [Test]
77 public void T010_StoreSimpleAsset()
78 {
79 AssetBase a1 = new AssetBase(uuid1, "asset one");
80 AssetBase a2 = new AssetBase(uuid2, "asset two");
81 AssetBase a3 = new AssetBase(uuid3, "asset three");
82 db.CreateAsset(a1);
83 db.CreateAsset(a2);
84 db.CreateAsset(a3);
85
86 AssetBase a1a = db.FetchAsset(uuid1);
87 Assert.That(a1.ID.ToString(), Text.Matches(a1a.ID.ToString()));
88 Assert.That(a1.Name, Text.Matches(a1a.Name));
89
90 AssetBase a2a = db.FetchAsset(uuid2);
91 Assert.That(a2.ID.ToString(), Text.Matches(a2a.ID.ToString()));
92 Assert.That(a2.Name, Text.Matches(a2a.Name));
93
94 AssetBase a3a = db.FetchAsset(uuid3);
95 Assert.That(a3.ID.ToString(), Text.Matches(a3a.ID.ToString()));
96 Assert.That(a3.Name, Text.Matches(a3a.Name));
97 }
98
99 [Test]
100 public void T011_ExistsSimpleAsset()
101 {
102 Assert.That(db.ExistsAsset(uuid1), Is.True);
103 Assert.That(db.ExistsAsset(uuid2), Is.True);
104 Assert.That(db.ExistsAsset(uuid3), Is.True);
105 }
106
107 // this has questionable use, but it is in the interface at the moment.
108 [Test]
109 public void T012_DeleteAsset()
110 {
111 db.DeleteAsset(uuid1);
112 db.DeleteAsset(uuid2);
113 db.DeleteAsset(uuid3);
114 Assert.That(db.ExistsAsset(uuid1), Is.False);
115 Assert.That(db.ExistsAsset(uuid2), Is.False);
116 Assert.That(db.ExistsAsset(uuid3), Is.False);
117 }
118 } 61 }
119} \ No newline at end of file 62} \ No newline at end of file