public void ActiveBrokerTokenIsDueToExpire_WhenMostRecentConnectionsTokenHasLessThan5Minutes_ShouldReturnTrue()
        {
            var sut = new BrokerConnectionManager();

            sut.AddConnection("oldconn1", 1, new DateTime(2010, 10, 10, 10, 10, 10));
            sut.AddConnection("oldconn2", 1, new DateTime(2011, 10, 10, 10, 10, 10));
            sut.AddConnection("newestConn", 1, DateTime.Now.AddMinutes(2));

            // Act
            var result = sut.ActiveBrokerTokenIsDueToExpire(1);

            // Assert
            Assert.IsTrue(result);
        }
        public void ActiveBrokerTokenIsDueToExpire_WhenBrokerIsNotInList_ShouldThrowApplicationException()
        {
            var sut = new BrokerConnectionManager();

            sut.AddConnection("oldconn1", 1, new DateTime(2010, 10, 10, 10, 10, 10));
            sut.AddConnection("oldconn2", 1, new DateTime(2011, 10, 10, 10, 10, 10));
            sut.AddConnection("newestConn", 1, DateTime.Now.AddMinutes(6));

            // Act
            var exception = Assert.Throws <ApplicationException>(() => sut.ActiveBrokerTokenIsDueToExpire(2));

            // Assert
            Assert.AreEqual("Cannot find Broker in list of connections", exception.Message);
        }
        public void ActiveBrokerTokenIsDueToExpire_WhenMostRecentConnectionsTokenHasLessThan5Minutes_ShouldReturnTrue()
        {
            var sut = new BrokerConnectionManager();

            sut.AddConnection("oldconn1", 1, new DateTime(2010, 10, 10, 10, 10, 10));
            sut.AddConnection("oldconn2", 1, new DateTime(2011, 10, 10, 10, 10, 10));
            sut.AddConnection("newestConn", 1, DateTime.Now.AddMinutes(2));

            // Act
            var result = sut.ActiveBrokerTokenIsDueToExpire(1);

            // Assert
            Assert.IsTrue(result);
        }
        public void ActiveBrokerTokenIsDueToExpire_WhenBrokerIsNotInList_ShouldThrowApplicationException()
        {
            var sut = new BrokerConnectionManager();

            sut.AddConnection("oldconn1", 1, new DateTime(2010, 10, 10, 10, 10, 10));
            sut.AddConnection("oldconn2", 1, new DateTime(2011, 10, 10, 10, 10, 10));
            sut.AddConnection("newestConn", 1, DateTime.Now.AddMinutes(6));

            // Act
            var exception = Assert.Throws<ApplicationException>(() => sut.ActiveBrokerTokenIsDueToExpire(2));

            // Assert
            Assert.AreEqual("Cannot find Broker in list of connections", exception.Message);
        }