public bool SubscribeOnLogOut(string username, UserLoggedOutHandle handle)
        {
            if (!_userCache.Confirm(username))
            {
                return(false);
            }

            lock (_listeners)
            {
                if (!_listeners.ContainsKey(username))
                {
                    _listeners.Add(username, new HashSet <UserLoggedOutHandle>());
                }

                return(_listeners[username].Add(handle));
            }
        }
예제 #2
0
        public void SubscribeOnLogout_UserExistNotPreviouslySubscribed_ReturnsTrue()
        {
            // Arrange

            var username = "******";

            _fakeUserCache.Confirm(username).Returns(true);

            var handle = new UserLoggedOutHandle((o, s) =>
            {
            });

            // Act and assert

            Assert.That(_uut.SubscribeOnLogOut(username, handle), Is.EqualTo(true));
        }