public void DefaultResolution()
        {
            var          entries          = BuildEntriesList(_rand.Next(), new[] { 10, 20, 30, 40, 50 });
            const string defaultIteration = "Default";
            var          resolver         = new DateBasedValueResolver(defaultIteration, entries);

            var value = resolver.Resolve(DateTime.Now);

            Assert.AreEqual(defaultIteration, value, "Expected value '{0}', received value '{1}'", defaultIteration, value);
        }
        public void BasicResolutionLastItem()
        {
            var entries  = BuildEntriesList(_rand.Next(), new[] { -6, -5, -4, -3, -2, -1 });
            var expected = entries[entries.Keys[entries.Count - 1]]; // We expect to get the value from the last entry

            var resolver = new DateBasedValueResolver("", entries);
            var value    = resolver.Resolve(DateTime.Now);

            Assert.AreEqual(expected, value, "Expected value '{0}', received value '{1}'", expected, value);
        }
        public void BasicResolutionMiddleItem()
        {
            var entries  = BuildEntriesList(_rand.Next(), new[] { -6, -5, -4, -3, 3, 50 });
            var expected = entries[entries.Keys[3]]; // We expect to get the value from the fourth entry (-3)

            var resolver = new DateBasedValueResolver("", entries);
            var value    = resolver.Resolve(DateTime.Now);

            Assert.AreEqual(expected, value, "Expected value '{0}', received value '{1}'", expected, value);
        }
        public void BasicResolutionFirstItem()
        {
            var entries = BuildEntriesList(_rand.Next(), new[] { -2, 7, 14 });

            // It is important to capture the expected entry before passing 'entries' to the constructor of
            // DateBasedValueResolver, because it alters the list by adding a new item at the beginning
            var expected = entries[entries.Keys[0]]; // We expect to get the value from the first entry

            var resolver = new DateBasedValueResolver("", entries);
            var value    = resolver.Resolve(DateTime.Now);

            Assert.AreEqual(expected, value, "Expected value '{0}', received value '{1}'", expected, value);
        }