public void AddConnection_WhenConnectionIsAlreadyInList_ShouldNotAddDuplicateConnection()
        {
            // Arrange
            // Act
            sut.AddConnection("conn1", 1, new DateTime(2010, 10, 10, 10, 10, 10));
            sut.AddConnection("conn1", 1, new DateTime(2010, 10, 10, 10, 10, 10));

            // Assert
            Assert.AreEqual(sut.NumberOfConnectedBrokers, 1);
        }
コード例 #2
0
        private void AddBrokerToConnections()
        {
            var claimsPrincipal = (ClaimsPrincipal)Context.User;
            var brokerId        = int.Parse(claimsPrincipal.Identity.Name);
            var tokenExpiresOn  = GetTokenExpiresOnDateFromClaims(claimsPrincipal);
            var connectionId    = Context.ConnectionId;

            brokerConnectionManager.AddConnection(connectionId, brokerId, tokenExpiresOn);
        }