Пример #1
0
        public void ShouldReturnFalse_WhenNoUserInPracticeIsConnected()
        {
            UserHandler userHandler  = new UserHandler();
            string      connectionId = Guid.NewGuid().ToString();

            User user = new User()
            {
                ApplicationType = ApplicationType.Ehr,
                UserId          = 42,
                PracticeId      = 36,
            };

            user.AddConnection(connectionId);

            string otherPracticeUserConnectionId = Guid.NewGuid().ToString();
            User   otherPracticeUser             = new User()
            {
                ApplicationType = ApplicationType.Ehr,
                UserId          = 42,
                PracticeId      = 103,
            };

            otherPracticeUser.AddConnection(otherPracticeUserConnectionId);

            string userIdentifier = otherPracticeUser.UserIdentifier;

            userHandler.AddConnectedUser(otherPracticeUser, new HubContextStub(connectionId, userIdentifier));
            Assert.False(userHandler.IsUserConnected(user));
        }
Пример #2
0
        public void ShouldReturnTrue_WhenConnectedUserIsAdded()
        {
            UserHandler userHandler  = new UserHandler();
            string      connectionId = Guid.NewGuid().ToString();

            User user = new User()
            {
                ApplicationType = ApplicationType.Ehr,
                UserId          = 42,
                PracticeId      = 36,
            };

            user.AddConnection(connectionId);

            string userIdentifier = user.UserIdentifier;

            userHandler.AddConnectedUser(user, new HubContextStub(connectionId, userIdentifier));
            Assert.True(userHandler.IsUserConnected(user));
        }