コード例 #1
0
        public void DisplayInvalidHit()
        {
            // Arrange
            SortedDictionary <string, string> dict = null;
            var target = new Routing();

            target.Dict   = dict;
            target.Letter = '\0';
            string actual   = target.DisplayAll();
            string expected = "Invalid";

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void DisplayNoHit()
        {
            // Arrange
            SortedDictionary <string, string> dict = new SortedDictionary <string, string>();
            var target = new Routing();

            target.Dict   = dict;
            target.Letter = 'A';
            string actual = target.DisplayAll();

            string expected = target.Letter + " has no matching prefix.";

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void DisplayHitMultiChars()
        {
            // Arrange
            SortedDictionary <string, string> dict = new SortedDictionary <string, string>();

            dict.Add("46732", "1.1");
            var lastKey   = dict.Keys.Last();
            var lastValue = dict.Values.Last();

            var target = new Routing();

            target.Dict   = dict;
            target.Letter = 'A';
            string actual = target.DisplayAll();

            string expected = target.Letter + " has the longest matching prefix: " + lastKey + " and its price: " + lastValue;

            //Assert
            Assert.AreEqual(expected, actual);
        }