aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-11-17 00:12:25 +0000
committerJustin Clark-Casey (justincc)2012-11-17 00:12:25 +0000
commite25c51330a3d0009f4308bf45cf057e216c17ba9 (patch)
treecc902dc51a3d1e31bd583a74bc778233781ca4ed /OpenSim/Services
parentrefactor: Move stat classes out of StatManager and into their own files for c... (diff)
downloadopensim-SC_OLD-e25c51330a3d0009f4308bf45cf057e216c17ba9.zip
opensim-SC_OLD-e25c51330a3d0009f4308bf45cf057e216c17ba9.tar.gz
opensim-SC_OLD-e25c51330a3d0009f4308bf45cf057e216c17ba9.tar.bz2
opensim-SC_OLD-e25c51330a3d0009f4308bf45cf057e216c17ba9.tar.xz
Add basic XInventoryServicesTests.TestAddItem() regression test.
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs87
1 files changed, 87 insertions, 0 deletions
diff --git a/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs b/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs
new file mode 100644
index 0000000..d2356c5
--- /dev/null
+++ b/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs
@@ -0,0 +1,87 @@
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 OpenSimulator 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
28using System;
29using Nini.Config;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Server.Base;
34using OpenSim.Services.Interfaces;
35using OpenSim.Tests.Common;
36
37namespace OpenSim.Services.InventoryService.Tests
38{
39 /// <summary>
40 /// Tests for the XInventoryService
41 /// </summary>
42 /// <remarks>
43 /// TODO: Fill out more tests.
44 /// </remarks>
45 [TestFixture]
46 public class XInventoryServiceTests
47 {
48 /// <summary>
49 /// Tests add item operation.
50 /// </summary>
51 /// <remarks>
52 /// TODO: Test all operations.
53 /// </remarks>
54 [Test]
55 public void TestAddItem()
56 {
57 string creatorId = TestHelpers.ParseTail(0x1).ToString();
58 UUID ownerId = TestHelpers.ParseTail(0x2);
59 UUID itemId = TestHelpers.ParseTail(0x10);
60 UUID assetId = TestHelpers.ParseTail(0x20);
61 string itemName = "item1";
62
63 IConfigSource config = new IniConfigSource();
64 config.AddConfig("InventoryService");
65 config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
66
67 IInventoryService xis
68 = ServerUtils.LoadPlugin<IInventoryService>(
69 "OpenSim.Services.InventoryService.dll:XInventoryService", new Object[] { config });
70
71 InventoryItemBase itemToStore
72 = new InventoryItemBase(itemId, ownerId)
73 { CreatorId = creatorId.ToString(), AssetID = assetId, Name = itemName };
74
75 xis.AddItem(itemToStore);
76
77 InventoryItemBase itemRetrieved = new InventoryItemBase(itemId);
78 itemRetrieved = xis.GetItem(itemRetrieved);
79
80 Assert.That(itemRetrieved, Is.Not.Null);
81 Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId));
82 Assert.That(itemRetrieved.Owner, Is.EqualTo(ownerId));
83 Assert.That(itemRetrieved.AssetID, Is.EqualTo(assetId));
84 Assert.That(itemRetrieved.Name, Is.EqualTo(itemName));
85 }
86 }
87} \ No newline at end of file