Example #1
0
        public void Constructor_WhenKeyIsValid_SetsKeyProperty(string key)
        {
            var topic = new Topic(key);

            Assert.AreEqual(key, topic.Key);
        }
Example #2
0
        public void ToString_ReturnsTheKey()
        {
            var topic = new Topic("my.topic");

            Assert.AreEqual("my.topic", topic.ToString());
        }
Example #3
0
        /// <summary>
        /// Returns true if this pattern matches the specified topic.
        /// </summary>
        /// <param name="topic">The topic to consider.</param>
        /// <returns>True if this pattern matches the specified topic.</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="topic"/> is null.</exception>
        public bool IsMatch(Topic topic)
        {
            if (topic == null)
                throw new ArgumentNullException("topic");

            return GetMatchRegex().IsMatch(topic.Key);
        }