public void TestGetRegisteredUsers() { UserCache userCache = null; try { userCache = new UserCache(); List<User> userList = new List<User>(userCache.GetRegisteredUsers()); Assert.That(userList.Count, NUnit.Framework.Is.EqualTo(0)); string username1 = "user1"; string hostname1 = username1 + "-ws"; string username2 = "user2"; string hostname2 = string.Empty; RegistrationRequest request1 = new RegistrationRequest(hostname1, username1); RegistrationRequest request2 = new RegistrationRequest(hostname2, username2); userCache.Register(request1); userCache.Register(request2); userList = new List<User>(userCache.GetRegisteredUsers()); Assert.That(userList.Count, NUnit.Framework.Is.EqualTo(1)); User user = userList[0]; Assert.That(user.Hostname, NUnit.Framework.Is.EqualTo(hostname1)); Assert.That(user.Username, NUnit.Framework.Is.EqualTo(username1)); } finally { if (userCache != null) { userCache.Dispose(); } } }