Exemple #1
0
        public void GetOffsetValueForValue_Direct()
        {
            Assert.AreEqual(0, SliderUtilities.GetOffsetValueForValue(5, 0, 100));
            Assert.AreEqual(0, SliderUtilities.GetOffsetValueForValue(5, 100, 200));

            Assert.AreEqual(2, SliderUtilities.GetOffsetValueForValue(5, 3, 100));
            Assert.AreEqual(2, SliderUtilities.GetOffsetValueForValue(5, 103, 200));

            Assert.AreEqual(0, SliderUtilities.GetOffsetValueForValue(10, 0, 100));
            Assert.AreEqual(0, SliderUtilities.GetOffsetValueForValue(10, 100, 200));

            Assert.AreEqual(5, SliderUtilities.GetOffsetValueForValue(10, 5, 100));
            Assert.AreEqual(5, SliderUtilities.GetOffsetValueForValue(10, 105, 200));
        }
Exemple #2
0
        public void GetOffsetValueForValue_Inserse()
        {
            Assert.AreEqual(0, SliderUtilities.GetOffsetValueForValue(5, 100, 0));
            Assert.AreEqual(0, SliderUtilities.GetOffsetValueForValue(5, 200, 100));

            Assert.AreEqual(2, SliderUtilities.GetOffsetValueForValue(5, 97, 0));
            Assert.AreEqual(2, SliderUtilities.GetOffsetValueForValue(5, 197, 100));

            Assert.AreEqual(0, SliderUtilities.GetOffsetValueForValue(10, 100, 0));
            Assert.AreEqual(0, SliderUtilities.GetOffsetValueForValue(10, 200, 100));

            Assert.AreEqual(5, SliderUtilities.GetOffsetValueForValue(10, 95, 0));
            Assert.AreEqual(5, SliderUtilities.GetOffsetValueForValue(10, 195, 100));

            Assert.AreEqual(3, SliderUtilities.GetOffsetValueForValue(10, 83, 3));
        }