From 0b07c9762b4c70b6d234b70fb9e591c770dc1bf1 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 5 Jan 2009 18:00:53 +0000 Subject: * Simplify test code by always setting up mock 'in memory' user and inventory data plugins for every TestCommunicationsManager * imo the gain in simplcity of test code outweighs the very small cost of setting up some stuff that some tests will never use --- .../Tests/Cache/UserProfileCacheServiceTests.cs | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs') diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index 807afcc..44a28a2 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs @@ -52,7 +52,7 @@ namespace OpenSim.Framework.Communications.Tests UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001"); UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002"); - CommunicationsManager commsManager = UserProfileTestUtils.SetupServices(); + TestCommunicationsManager commsManager = new TestCommunicationsManager(); CachedUserInfo existingUserInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, existingUserId); Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found"); @@ -68,7 +68,7 @@ namespace OpenSim.Framework.Communications.Tests [Test] public void TestRequestInventoryForUser() { - CommunicationsManager commsManager = UserProfileTestUtils.SetupServices(); + TestCommunicationsManager commsManager = new TestCommunicationsManager(); CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); Assert.That(userInfo.HasReceivedInventory, Is.True); @@ -80,7 +80,7 @@ namespace OpenSim.Framework.Communications.Tests [Test] public void TestGetChildFolder() { - CommunicationsManager commsManager = UserProfileTestUtils.SetupServices(); + TestCommunicationsManager commsManager = new TestCommunicationsManager(); CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); @@ -96,12 +96,12 @@ namespace OpenSim.Framework.Communications.Tests /// [Test] public void TestCreateFolder() - { - IUserDataPlugin userDataPlugin = new TestUserDataPlugin(); - IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin(); + { + TestCommunicationsManager commsManager = new TestCommunicationsManager(); + + IUserDataPlugin userDataPlugin = commsManager.UserDataPlugin; + IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; - CommunicationsManager commsManager - = UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin); CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); @@ -129,11 +129,11 @@ namespace OpenSim.Framework.Communications.Tests [Test] public void TestUpdateFolder() { - IUserDataPlugin userDataPlugin = new TestUserDataPlugin(); - IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin(); + TestCommunicationsManager commsManager = new TestCommunicationsManager(); + + IUserDataPlugin userDataPlugin = commsManager.UserDataPlugin; + IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; - CommunicationsManager commsManager - = UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin); CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); @@ -188,11 +188,11 @@ namespace OpenSim.Framework.Communications.Tests [Test] public void TestMoveFolder() { - IUserDataPlugin userDataPlugin = new TestUserDataPlugin(); - IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin(); + TestCommunicationsManager commsManager = new TestCommunicationsManager(); + + IUserDataPlugin userDataPlugin = commsManager.UserDataPlugin; + IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; - CommunicationsManager commsManager - = UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin); CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); @@ -226,11 +226,11 @@ namespace OpenSim.Framework.Communications.Tests { //log4net.Config.XmlConfigurator.Configure(); - IUserDataPlugin userDataPlugin = new TestUserDataPlugin(); - IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin(); + TestCommunicationsManager commsManager = new TestCommunicationsManager(); + + IUserDataPlugin userDataPlugin = commsManager.UserDataPlugin; + IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; - CommunicationsManager commsManager - = UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin); CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); -- cgit v1.1