Exemplo n.º 1
0
        public void should_return_interval_containing_point()
        {
            SortedDictionary <double, double> mainPoints = new SortedDictionary <double, double>
            {
                { 0.25, 1 },
                { 0.5, 3 },
                { 0.75, 4 },
                { 1, 9 },
                { 1.25, 10 },
                { 1.5, 16 },
                { 2, 18 },
            };

            double x             = 0.84;
            int    expectedLower = 2;

            Tuple <int, int> interval = null;

            try
            {
                interval = Tools.FindIndexInterval(mainPoints, x);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }

            Assert.IsTrue(interval.Item1.Equals(expectedLower) && interval.Item2.Equals(expectedLower + 1));
        }