aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMike Mazur2009-03-09 08:07:12 +0000
committerMike Mazur2009-03-09 08:07:12 +0000
commit5bee29e036d9212319b4b752cb3869fe12c80412 (patch)
tree73ec2af3c0688757c317f2e911f2a9ffb2323bbf /OpenSim/Framework
parentFix tests broken in r8732. (diff)
downloadopensim-SC_OLD-5bee29e036d9212319b4b752cb3869fe12c80412.zip
opensim-SC_OLD-5bee29e036d9212319b4b752cb3869fe12c80412.tar.gz
opensim-SC_OLD-5bee29e036d9212319b4b752cb3869fe12c80412.tar.bz2
opensim-SC_OLD-5bee29e036d9212319b4b752cb3869fe12c80412.tar.xz
Refactor login test class.
There were multiple tests in one test method (T011_Auth_Login). This test has been refactored into multiple tests. Common setup code was placed into a SetUp method executed before each test.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Tests/LoginServiceTests.cs241
1 files changed, 126 insertions, 115 deletions
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index d8d08c9..daa2a89 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -47,46 +47,54 @@ namespace OpenSim.Framework.Communications.Tests
47 [TestFixture] 47 [TestFixture]
48 public class LoginServiceTests 48 public class LoginServiceTests
49 { 49 {
50 /// <summary> 50 private string m_firstName = "Adam";
51 /// Test the normal response to a login. Does not test authentication. 51 private string m_lastName = "West";
52 /// </summary> 52 private string m_regionExternalName = "localhost";
53 [Test] 53
54 public void T010_NormalLoginResponse() 54 private IPEndPoint m_capsEndPoint;
55 private CommunicationsManager m_commsManager;
56 private TestLoginToRegionConnector m_regionConnector;
57 private LocalUserServices m_localUserServices;
58 private LoginService m_loginService;
59 private UserProfileData m_userProfileData;
60
61 [SetUp]
62 public void SetUpLoginEnviroment()
55 { 63 {
56 //log4net.Config.XmlConfigurator.Configure(); 64 m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123);
65 m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43));
66 m_regionConnector = new TestLoginToRegionConnector();
57 67
58 string firstName = "Timmy"; 68 m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName));
59 string lastName = "Mallet";
60 string regionExternalName = "localhost";
61 IPEndPoint capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123);
62 69
63 CommunicationsManager commsManager 70 m_localUserServices = (LocalUserServices) m_commsManager.UserService;
64 = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); 71 m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43);
65
66 //commsManager.GridService.RegisterRegion(
67 // new RegionInfo(42, 43, capsEndPoint, regionExternalName));
68 //commsManager.GridService.RegionLoginsEnabled = true;
69 72
70 //LoginService loginService 73 m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", m_commsManager.InterServiceInventoryService,
71 // = new LocalLoginService( 74 m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector);
72 // (UserManagerBase)commsManager.UserService, "Hello folks", commsManager.InterServiceInventoryService,
73 // (LocalBackEndServices)commsManager.GridService,
74 // commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty));
75 75
76 TestLoginToRegionConnector regionConnector = new TestLoginToRegionConnector(); 76 m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName);
77 regionConnector.AddRegion(new RegionInfo(42, 43, capsEndPoint, regionExternalName)); 77 }
78 78
79 LoginService loginService = new LLStandaloneLoginService((UserManagerBase)commsManager.UserService, "Hello folks", commsManager.InterServiceInventoryService, 79 /// <summary>
80 commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), regionConnector); 80 /// Test the normal response to a login. Does not test authentication.
81 /// </summary>
82 [Test]
83 public void TestUnauthenticatedLogin()
84 {
85 // We want to use our own LoginService for this test, one that
86 // doesn't require authentication.
87 LoginService loginService = new LLStandaloneLoginService((UserManagerBase)m_commsManager.UserService, "Hello folks", m_commsManager.InterServiceInventoryService,
88 m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector);
81 89
82 Hashtable loginParams = new Hashtable(); 90 Hashtable loginParams = new Hashtable();
83 loginParams["first"] = firstName; 91 loginParams["first"] = m_firstName;
84 loginParams["last"] = lastName; 92 loginParams["last"] = m_lastName;
85 loginParams["passwd"] = "boingboing"; 93 loginParams["passwd"] = "boingboing";
86 94
87 ArrayList sendParams = new ArrayList(); 95 ArrayList sendParams = new ArrayList();
88 sendParams.Add(loginParams); 96 sendParams.Add(loginParams);
89 sendParams.Add(capsEndPoint); // is this parameter correct? 97 sendParams.Add(m_capsEndPoint); // is this parameter correct?
90 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? 98 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
91 99
92 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 100 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
@@ -94,78 +102,48 @@ namespace OpenSim.Framework.Communications.Tests
94 XmlRpcResponse response = loginService.XmlRpcLoginMethod(request); 102 XmlRpcResponse response = loginService.XmlRpcLoginMethod(request);
95 Hashtable responseData = (Hashtable)response.Value; 103 Hashtable responseData = (Hashtable)response.Value;
96 104
97 Assert.That(responseData["first_name"], Is.EqualTo(firstName)); 105 Assert.That(responseData["first_name"], Is.EqualTo(m_firstName));
98 Assert.That(responseData["last_name"], Is.EqualTo(lastName)); 106 Assert.That(responseData["last_name"], Is.EqualTo(m_lastName));
99 Assert.That( 107 Assert.That(
100 responseData["circuit_code"], Is.GreaterThanOrEqualTo(0) & Is.LessThanOrEqualTo(Int32.MaxValue)); 108 responseData["circuit_code"], Is.GreaterThanOrEqualTo(0) & Is.LessThanOrEqualTo(Int32.MaxValue));
101 109
102 Regex capsSeedPattern 110 Regex capsSeedPattern
103 = new Regex("^http://" 111 = new Regex("^http://"
104 + regionExternalName 112 + m_regionExternalName
105 + ":9000/CAPS/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{8}0000/$"); 113 + ":9000/CAPS/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{8}0000/$");
106 114
107 Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True); 115 Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True);
108 } 116 }
109 117
110 [Test] 118 [Test]
111 public void T011_Auth_Login() 119 public void TestAuthenticatedLoginSuccess()
112 { 120 {
113 string firstName = "Adam";
114 string lastName = "West";
115 string regionExternalName = "localhost";
116 IPEndPoint capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123);
117
118 CommunicationsManager commsManager
119 = new TestCommunicationsManager(new NetworkServersInfo(42, 43));
120
121 LocalUserServices lus = (LocalUserServices)commsManager.UserService;
122
123 lus.AddUser(firstName,lastName,"boingboing","abc@ftw.com",42,43);
124
125 //commsManager.GridService.RegisterRegion(
126 // new RegionInfo(42, 43, capsEndPoint, regionExternalName));
127 //commsManager.GridService.RegionLoginsEnabled = true;
128
129 //LoginService loginService
130 // = new LocalLoginService(
131 // (UserManagerBase)lus, "Hello folks", commsManager.InterServiceInventoryService,
132 // (LocalBackEndServices)commsManager.GridService,
133 // commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty));
134
135 TestLoginToRegionConnector regionConnector = new TestLoginToRegionConnector();
136 regionConnector.AddRegion(new RegionInfo(42, 43, capsEndPoint, regionExternalName));
137
138 LoginService loginService = new LLStandaloneLoginService((UserManagerBase) lus, "Hello folks", commsManager.InterServiceInventoryService,
139 commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), regionConnector);
140
141 // TODO: Not check inventory part of response yet. 121 // TODO: Not check inventory part of response yet.
142 // TODO: Not checking all of login response thoroughly yet. 122 // TODO: Not checking all of login response thoroughly yet.
143 123
144 // 1) Test for positive authentication 124 // 1) Test for positive authentication
145 125
146 Hashtable loginParams = new Hashtable(); 126 Hashtable loginParams = new Hashtable();
147 loginParams["first"] = firstName; 127 loginParams["first"] = m_firstName;
148 loginParams["last"] = lastName; 128 loginParams["last"] = m_lastName;
149 loginParams["passwd"] = "boingboing"; 129 loginParams["passwd"] = "boingboing";
150 130
151 ArrayList sendParams = new ArrayList(); 131 ArrayList sendParams = new ArrayList();
152 sendParams.Add(loginParams); 132 sendParams.Add(loginParams);
153 sendParams.Add(capsEndPoint); // is this parameter correct? 133 sendParams.Add(m_capsEndPoint); // is this parameter correct?
154 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? 134 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
155 135
156 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 136 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
157 137
158 XmlRpcResponse response = loginService.XmlRpcLoginMethod(request); 138 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
159 Hashtable responseData = (Hashtable)response.Value; 139 Hashtable responseData = (Hashtable)response.Value;
160 140
161 UserProfileData uprof = lus.GetUserProfile(firstName,lastName); 141 UserAgentData uagent = m_userProfileData.CurrentAgent;
162
163 UserAgentData uagent = uprof.CurrentAgent;
164 Assert.That(uagent,Is.Not.Null); 142 Assert.That(uagent,Is.Not.Null);
165 143
166 Assert.That(responseData["first_name"], Is.Not.Null); 144 Assert.That(responseData["first_name"], Is.Not.Null);
167 Assert.That(responseData["first_name"], Is.EqualTo(firstName)); 145 Assert.That(responseData["first_name"], Is.EqualTo(m_firstName));
168 Assert.That(responseData["last_name"], Is.EqualTo(lastName)); 146 Assert.That(responseData["last_name"], Is.EqualTo(m_lastName));
169 Assert.That(responseData["agent_id"], Is.EqualTo(uagent.ProfileID.ToString())); 147 Assert.That(responseData["agent_id"], Is.EqualTo(uagent.ProfileID.ToString()));
170 Assert.That(responseData["session_id"], Is.EqualTo(uagent.SessionID.ToString())); 148 Assert.That(responseData["session_id"], Is.EqualTo(uagent.SessionID.ToString()));
171 Assert.That(responseData["secure_session_id"], Is.EqualTo(uagent.SecureSessionID.ToString())); 149 Assert.That(responseData["secure_session_id"], Is.EqualTo(uagent.SecureSessionID.ToString()));
@@ -180,34 +158,38 @@ namespace OpenSim.Framework.Communications.Tests
180 158
181 Regex capsSeedPattern 159 Regex capsSeedPattern
182 = new Regex("^http://" 160 = new Regex("^http://"
183 + regionExternalName 161 + m_regionExternalName
184 + ":9000/CAPS/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{8}0000/$"); 162 + ":9000/CAPS/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{8}0000/$");
185 163
186 Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True); 164 Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True);
165 }
187 166
167 [Test]
168 public void TestAuthenticatedLoginForBuddies()
169 {
188 // 1.1) Test for budddies! 170 // 1.1) Test for budddies!
189 lus.AddUser("Friend","Number1","boingboing","abc@ftw.com",42,43); 171 m_localUserServices.AddUser("Friend","Number1","boingboing","abc@ftw.com",42,43);
190 lus.AddUser("Friend","Number2","boingboing","abc@ftw.com",42,43); 172 m_localUserServices.AddUser("Friend","Number2","boingboing","abc@ftw.com",42,43);
191 173
192 UserProfileData friend1 = lus.GetUserProfile("Friend","Number1"); 174 UserProfileData friend1 = m_localUserServices.GetUserProfile("Friend","Number1");
193 UserProfileData friend2 = lus.GetUserProfile("Friend","Number2"); 175 UserProfileData friend2 = m_localUserServices.GetUserProfile("Friend","Number2");
194 lus.AddNewUserFriend(friend1.ID,uprof.ID,1); 176 m_localUserServices.AddNewUserFriend(friend1.ID,m_userProfileData.ID,1);
195 lus.AddNewUserFriend(friend1.ID,friend2.ID,2); 177 m_localUserServices.AddNewUserFriend(friend1.ID,friend2.ID,2);
196 178
197 loginParams = new Hashtable(); 179 Hashtable loginParams = new Hashtable();
198 loginParams["first"] = "Friend"; 180 loginParams["first"] = "Friend";
199 loginParams["last"] = "Number1"; 181 loginParams["last"] = "Number1";
200 loginParams["passwd"] = "boingboing"; 182 loginParams["passwd"] = "boingboing";
201 183
202 sendParams = new ArrayList(); 184 ArrayList sendParams = new ArrayList();
203 sendParams.Add(loginParams); 185 sendParams.Add(loginParams);
204 sendParams.Add(capsEndPoint); // is this parameter correct? 186 sendParams.Add(m_capsEndPoint); // is this parameter correct?
205 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? 187 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
206 188
207 request = new XmlRpcRequest("login_to_simulator", sendParams); 189 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
208 190
209 response = loginService.XmlRpcLoginMethod(request); 191 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
210 responseData = (Hashtable)response.Value; 192 Hashtable responseData = (Hashtable)response.Value;
211 193
212 ArrayList friendslist = (ArrayList) responseData["buddy-list"]; 194 ArrayList friendslist = (ArrayList) responseData["buddy-list"];
213 195
@@ -217,89 +199,118 @@ namespace OpenSim.Framework.Communications.Tests
217 Hashtable buddy1 = (Hashtable) friendslist[0]; 199 Hashtable buddy1 = (Hashtable) friendslist[0];
218 Hashtable buddy2 = (Hashtable) friendslist[1]; 200 Hashtable buddy2 = (Hashtable) friendslist[1];
219 Assert.That(friendslist.Count, Is.EqualTo(2)); 201 Assert.That(friendslist.Count, Is.EqualTo(2));
220 Assert.That(uprof.ID.ToString(), Is.EqualTo(buddy1["buddy_id"]) | Is.EqualTo(buddy2["buddy_id"])); 202 Assert.That(m_userProfileData.ID.ToString(), Is.EqualTo(buddy1["buddy_id"]) | Is.EqualTo(buddy2["buddy_id"]));
221 Assert.That(friend2.ID.ToString(), Is.EqualTo(buddy1["buddy_id"]) | Is.EqualTo(buddy2["buddy_id"])); 203 Assert.That(friend2.ID.ToString(), Is.EqualTo(buddy1["buddy_id"]) | Is.EqualTo(buddy2["buddy_id"]));
204 }
205
206 [Test]
207 public void TestAuthenticatedLoginBadUsername()
208 {
222 209
223 // 2) Test for negative authentication 210 // 2) Test for negative authentication
224 // 211 //
225 string error_auth_message = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist."; 212 string error_auth_message = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.";
226 string error_xml_message = "Error connecting to grid. Could not percieve credentials from login XML.";
227 string error_already_logged = "You appear to be already logged in. " +
228 "If this is not the case please wait for your session to timeout. " +
229 "If this takes longer than a few minutes please contact the grid owner. " +
230 "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.";
231 //string error_region_unavailable = "The region you are attempting to log into is not responding. Please select another region and try again."; 213 //string error_region_unavailable = "The region you are attempting to log into is not responding. Please select another region and try again.";
232 // 2.1) Test for wrong user name 214 // 2.1) Test for wrong user name
233 loginParams = new Hashtable(); 215 Hashtable loginParams = new Hashtable();
234 loginParams["first"] = lastName; 216 loginParams["first"] = m_lastName;
235 loginParams["last"] = firstName; 217 loginParams["last"] = m_firstName;
236 loginParams["passwd"] = "boingboing"; 218 loginParams["passwd"] = "boingboing";
237 219
238 sendParams = new ArrayList(); 220 ArrayList sendParams = new ArrayList();
239 sendParams.Add(loginParams); 221 sendParams.Add(loginParams);
240 sendParams.Add(capsEndPoint); // is this parameter correct? 222 sendParams.Add(m_capsEndPoint); // is this parameter correct?
241 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? 223 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
242 224
243 request = new XmlRpcRequest("login_to_simulator", sendParams); 225 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
244 226
245 response = loginService.XmlRpcLoginMethod(request); 227 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
246 responseData = (Hashtable)response.Value; 228 Hashtable responseData = (Hashtable)response.Value;
247 Assert.That(responseData["message"], Is.EqualTo(error_auth_message)); 229 Assert.That(responseData["message"], Is.EqualTo(error_auth_message));
248 230
231 }
232
233 [Test]
234 public void TestAuthenticatedLoginBadPassword()
235 {
236 string error_auth_message = "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.";
249 // 2.2) Test for wrong password 237 // 2.2) Test for wrong password
250 loginParams = new Hashtable(); 238 Hashtable loginParams = new Hashtable();
251 loginParams["first"] = "Friend"; 239 loginParams["first"] = "Friend";
252 loginParams["last"] = "Number2"; 240 loginParams["last"] = "Number2";
253 loginParams["passwd"] = "boing"; 241 loginParams["passwd"] = "boing";
254 242
255 sendParams = new ArrayList(); 243 ArrayList sendParams = new ArrayList();
256 sendParams.Add(loginParams); 244 sendParams.Add(loginParams);
257 sendParams.Add(capsEndPoint); // is this parameter correct? 245 sendParams.Add(m_capsEndPoint); // is this parameter correct?
258 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? 246 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
259 247
260 request = new XmlRpcRequest("login_to_simulator", sendParams); 248 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
261 249
262 response = loginService.XmlRpcLoginMethod(request); 250 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
263 responseData = (Hashtable)response.Value; 251 Hashtable responseData = (Hashtable)response.Value;
264 Assert.That(responseData["message"], Is.EqualTo(error_auth_message)); 252 Assert.That(responseData["message"], Is.EqualTo(error_auth_message));
265 253
254 }
255
256 [Test]
257 public void TestAuthenticatedLoginBadXml()
258 {
259 string error_xml_message = "Error connecting to grid. Could not percieve credentials from login XML.";
266 // 2.3) Bad XML 260 // 2.3) Bad XML
267 loginParams = new Hashtable(); 261 Hashtable loginParams = new Hashtable();
268 loginParams["first"] = "Friend"; 262 loginParams["first"] = "Friend";
269 loginParams["banana"] = "Banana"; 263 loginParams["banana"] = "Banana";
270 loginParams["passwd"] = "boingboing"; 264 loginParams["passwd"] = "boingboing";
271 265
272 sendParams = new ArrayList(); 266 ArrayList sendParams = new ArrayList();
273 sendParams.Add(loginParams); 267 sendParams.Add(loginParams);
274 sendParams.Add(capsEndPoint); // is this parameter correct? 268 sendParams.Add(m_capsEndPoint); // is this parameter correct?
275 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? 269 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
276 270
277 request = new XmlRpcRequest("login_to_simulator", sendParams); 271 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
278 272
279 response = loginService.XmlRpcLoginMethod(request); 273 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
280 responseData = (Hashtable)response.Value; 274 Hashtable responseData = (Hashtable)response.Value;
281 Assert.That(responseData["message"], Is.EqualTo(error_xml_message)); 275 Assert.That(responseData["message"], Is.EqualTo(error_xml_message));
282 276
277 }
278
279 [Test]
280 public void TestAuthenticatedLoginAlreadyLoggedIn()
281 {
282 string error_already_logged = "You appear to be already logged in. " +
283 "If this is not the case please wait for your session to timeout. " +
284 "If this takes longer than a few minutes please contact the grid owner. " +
285 "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.";
283 // 2.4) Already logged in and sucessfull post login 286 // 2.4) Already logged in and sucessfull post login
284 loginParams = new Hashtable(); 287 Hashtable loginParams = new Hashtable();
285 loginParams["first"] = "Adam"; 288 loginParams["first"] = "Adam";
286 loginParams["last"] = "West"; 289 loginParams["last"] = "West";
287 loginParams["passwd"] = "boingboing"; 290 loginParams["passwd"] = "boingboing";
288 291
289 sendParams = new ArrayList(); 292 ArrayList sendParams = new ArrayList();
290 sendParams.Add(loginParams); 293 sendParams.Add(loginParams);
291 sendParams.Add(capsEndPoint); // is this parameter correct? 294 sendParams.Add(m_capsEndPoint); // is this parameter correct?
292 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct? 295 sendParams.Add(new Uri("http://localhost:8002/")); // is this parameter correct?
293 296
297 // First we log in.
298 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
299 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request);
300 Hashtable responseData = (Hashtable)response.Value;
301 Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
302
303 // Then we try again, this time expecting failure.
294 request = new XmlRpcRequest("login_to_simulator", sendParams); 304 request = new XmlRpcRequest("login_to_simulator", sendParams);
295 305
296 response = loginService.XmlRpcLoginMethod(request); 306 response = m_loginService.XmlRpcLoginMethod(request);
297 responseData = (Hashtable)response.Value; 307 responseData = (Hashtable)response.Value;
298 Assert.That(responseData["message"], Is.EqualTo(error_already_logged)); 308 Assert.That(responseData["message"], Is.EqualTo(error_already_logged));
299 309
310 // Finally the third time we should be able to get right back in.
300 request = new XmlRpcRequest("login_to_simulator", sendParams); 311 request = new XmlRpcRequest("login_to_simulator", sendParams);
301 312
302 response = loginService.XmlRpcLoginMethod(request); 313 response = m_loginService.XmlRpcLoginMethod(request);
303 responseData = (Hashtable)response.Value; 314 responseData = (Hashtable)response.Value;
304 Assert.That(responseData["message"], Is.EqualTo("Hello folks")); 315 Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
305 } 316 }