public void Given_5_min_per_mile_should_convert_to_8_min_km()
        {
            var calc = new PaceCalculator();
            var pace = new PaceData { Pace = "5:00", Calc = "pacemilesunits" };
            calc.Calculate(pace);
            Assert.AreEqual("8:02", pace.Pace); // 5 min/mile is actually a little over 8 min/km

            pace.Calc = "pacekmunits";
            calc.Calculate(pace);
            Assert.AreEqual("4:59", pace.Pace); // and then due to rounding, converting back gives just under 5min/mile
        }
            public RunLogModel(ControllerContext context, dynamic runLogEvent)
            {
                this.context = context;
                RunLogEvent = runLogEvent;

                TimeTaken = runLogEvent.TimeTaken;
                Route = ((object)RunLogEvent).Route();
                Distance = ((object)Route).Distance().ConvertTo(context.UserDistanceUnits());

                var paceData = new PaceData { Distance = Distance, Time = TimeTaken, Calc = "Pace" };
                var paceCalc = new PaceCalculator();
                paceCalc.Calculate(paceData);
                Pace = paceData;
            }
 private Tuple<Distance, PaceData, string> DistanceAndPaceOfLogEvent(dynamic runLogEvent)
 {
     var route = ((object)runLogEvent).Route();
     var distance = ((object)route).Distance().ConvertTo(ControllerContext.UserDistanceUnits());
     var paceData = new PaceData { Distance = distance, Time = runLogEvent.TimeTaken, Calc = "Pace" };
     var paceCalc = new PaceCalculator();
     paceCalc.Calculate(paceData);
     return Tuple.Create(distance, paceData, route.Name.Replace('"', '\''));
 }