Пример #1
0
        public void DegreeTimeSpanConversionTest(double value)
        {
            var actualTimeSpan   = DegreeHelper.DegreeToTimeSpan(value);
            var expectedTimeSpan = new TimeSpan((int)Math.Floor(value / 15), (int)Math.Floor(value % 15) * 4, (int)Math.Floor((value % 0.25) * 240));

            Assert.Equal(expectedTimeSpan.Hours, actualTimeSpan.Hours);
            Assert.Equal(expectedTimeSpan.Minutes, actualTimeSpan.Minutes);
            Assert.Equal(expectedTimeSpan.Seconds, actualTimeSpan.Seconds);

            var actualDegrees = DegreeHelper.TimeSpanToDegree(actualTimeSpan);

            Assert.Equal(value, actualDegrees);
        }
Пример #2
0
        public void TimeToDegreeTest(int hours, int minutes, int seconds, double expected)
        {
            var actualTimeSpan = DegreeHelper.TimeSpanToDegree(new TimeSpan(hours, minutes, seconds));

            Assert.Equal(expected, actualTimeSpan);
        }