Exemple #1
0
        public void ShouldReturnTheNumberNearestToTheValue(int numberToSearchFor, string expectedReturnText)
        {
            var list = new NumberTextList()
            {
                { 1, "I" },
                { 4, "IV" },
                { 5, "V" },
                { 9, "IX" },
                { 10, "X" },
                { 40, "XL" },
                { 50, "L" },
                { 90, "XC" },
                { 100, "C" },
                { 400, "CD" },
                { 500, "D" },
                { 900, "CM" },
                { 1000, "M" },
                { 4000, "MV" },
                { 5000, "V" },
            };

            var result = list.GetNearestNumber(numberToSearchFor);

            Assert.That(result.Text, Is.EqualTo(expectedReturnText));
        }
        public void ShouldReturnTheNumberEqualToTheValue(int numberToSearchFor, string expectedReturnText)
        {
            var list = new NumberTextList()
            {
                {10,"A"},
                {20,"B"},
                {30,"C"}
            };

            var result = list.GetNearestNumber(numberToSearchFor);
            Assert.That(result.Text, Is.EqualTo(expectedReturnText));
        }
Exemple #3
0
        public void ShouldReturnTheNumberEqualToTheValue(int numberToSearchFor, string expectedReturnText)
        {
            var list = new NumberTextList()
            {
                { 10, "A" },
                { 20, "B" },
                { 30, "C" }
            };

            var result = list.GetNearestNumber(numberToSearchFor);

            Assert.That(result.Text, Is.EqualTo(expectedReturnText));
        }
        public void ShouldReturnTheNumberNearestToTheValue(int numberToSearchFor, string expectedReturnText)
        {
            var list = new NumberTextList()
                {
                    {1, "I"},
                    {4, "IV"},
                    {5, "V"},
                    {9, "IX"},
                    {10, "X"},
                    {40, "XL"},
                    {50, "L"},
                    {90, "XC"},
                    {100, "C"},
                    {400, "CD"},
                    {500, "D"},
                    {900, "CM"},
                    {1000, "M"},
                    {4000, "MV"},
                    {5000, "V"},
                };

            var result = list.GetNearestNumber(numberToSearchFor);
            Assert.That(result.Text, Is.EqualTo(expectedReturnText));
        }