From 89632f3ea8c355e5e860eb787aa21f90e79762d8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 14 Nov 2011 20:56:56 +0000 Subject: Add test for removing a friendship. --- .../Avatar/Friends/Tests/FriendModuleTests.cs | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Friends/Tests') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs index c945dcf..682fbab 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs @@ -71,12 +71,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); - Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0)); - Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(0)); + Assert.That(((TestClient)sp.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0)); + Assert.That(((TestClient)sp.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(0)); } [Test] - public void TestAddFriendWhileOnline() + public void TestAddFriendshipWhileOnline() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -91,8 +91,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests // notification. m_fm.AddFriendship(sp.ControllingClient, user2Id); - Assert.That(((TestClient)sp.ControllingClient).OfflineNotificationsReceived.Count, Is.EqualTo(0)); - Assert.That(((TestClient)sp.ControllingClient).OnlineNotificationsReceived.Count, Is.EqualTo(1)); + Assert.That(((TestClient)sp.ControllingClient).ReceivedOfflineNotifications.Count, Is.EqualTo(0)); + Assert.That(((TestClient)sp.ControllingClient).ReceivedOnlineNotifications.Count, Is.EqualTo(1)); + } + + [Test] + public void TestRemoveFriendshipWhileOnline() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID user1Id = TestHelpers.ParseTail(0x1); + UUID user2Id = TestHelpers.ParseTail(0x2); + + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, user1Id); + SceneHelpers.AddScenePresence(m_scene, user2Id); + + m_fm.AddFriendship(sp.ControllingClient, user2Id); + m_fm.RemoveFriendship(sp.ControllingClient, user2Id); + + TestClient user1Client = sp.ControllingClient as TestClient; + Assert.That(user1Client.ReceivedFriendshipTerminations.Count, Is.EqualTo(1)); + Assert.That(user1Client.ReceivedFriendshipTerminations[0], Is.EqualTo(user2Id)); } } } \ No newline at end of file -- cgit v1.1