diff options
author | Justin Clark-Casey (justincc) | 2012-03-29 03:19:45 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-29 03:19:45 +0100 |
commit | 012b01f224dac8259eb0978aa7ef5a098924b7c8 (patch) | |
tree | 2f4f0619c5cdfd416ea61205cb2002fd18fc23fb /OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-012b01f224dac8259eb0978aa7ef5a098924b7c8.zip opensim-SC_OLD-012b01f224dac8259eb0978aa7ef5a098924b7c8.tar.gz opensim-SC_OLD-012b01f224dac8259eb0978aa7ef5a098924b7c8.tar.bz2 opensim-SC_OLD-012b01f224dac8259eb0978aa7ef5a098924b7c8.tar.xz |
Add simple regression test for logging in with offline friends. Don't expect to receive any in this instance.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs index 682fbab..34c68cc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs | |||
@@ -44,6 +44,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests | |||
44 | private FriendsModule m_fm; | 44 | private FriendsModule m_fm; |
45 | private TestScene m_scene; | 45 | private TestScene m_scene; |
46 | 46 | ||
47 | [TestFixtureSetUp] | ||
48 | public void FixtureInit() | ||
49 | { | ||
50 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
51 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
52 | } | ||
53 | |||
54 | [TestFixtureTearDown] | ||
55 | public void TearDown() | ||
56 | { | ||
57 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
58 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
59 | // tests really shouldn't). | ||
60 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
61 | } | ||
62 | |||
47 | [SetUp] | 63 | [SetUp] |
48 | public void Init() | 64 | public void Init() |
49 | { | 65 | { |
@@ -62,7 +78,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests | |||
62 | } | 78 | } |
63 | 79 | ||
64 | [Test] | 80 | [Test] |
65 | public void TestNoFriends() | 81 | public void TestLoginWithNoFriends() |
66 | { | 82 | { |
67 | TestHelpers.InMethod(); | 83 | TestHelpers.InMethod(); |
68 | // log4net.Config.XmlConfigurator.Configure(); | 84 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -76,6 +92,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests | |||
76 | } | 92 | } |
77 | 93 | ||
78 | [Test] | 94 | [Test] |
95 | public void TestLoginWithOfflineFriends() | ||
96 | { | ||
97 | TestHelpers.InMethod(); | ||
98 | // log4net.Config.XmlConfigurator.Configure(); | ||
99 | |||
100 | UUID user1Id = TestHelpers.ParseTail(0x1); | ||
101 | UUID user2Id = TestHelpers.ParseTail(0x2); | ||
102 | |||
103 | // UserAccountHelpers.CreateUserWithInventory(m_scene, user1Id); | ||
104 | // UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id); | ||
105 | // | ||
106 | // m_fm.AddFriendship(user1Id, user2Id); | ||
107 | |||
108 | ScenePresence sp1 = SceneHelpers.AddScenePresence(m_scene, user1Id); | ||
109 | ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, user2Id); | ||
110 | |||
111 | m_fm.AddFriendship(sp1.ControllingClient, user2Id); | ||
112 | |||
113 | m_scene.RemoveClient(sp1.UUID, true); | ||
114 | m_scene.RemoveClient(sp2.UUID, true); | ||
115 | |||
116 | ScenePresence sp1Redux = SceneHelpers.AddScenePresence(m_scene, user1Id); | ||
117 | |||
118 | // We don't expect to receive notifications of offline friends on login, just online. | ||
119 | Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0)); | ||
120 | Assert.That(((TestClient)sp1Redux.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(0)); | ||
121 | } | ||
122 | |||
123 | [Test] | ||
79 | public void TestAddFriendshipWhileOnline() | 124 | public void TestAddFriendshipWhileOnline() |
80 | { | 125 | { |
81 | TestHelpers.InMethod(); | 126 | TestHelpers.InMethod(); |