Example #1
0
        public void PreciseDeltaFormatterFormatTimeAsDash_WhenTimeIsNull()
        {
            var sut = new PreciseDeltaFormatter(TimeAccuracy.Hundredths);

            var formattedTime = sut.Format(null);

            Assert.Equal(TimeFormatConstants.DASH, formattedTime);
        }
Example #2
0
        public void PreciseDeltaFormatterFormatsTimeCorrectly_WhenTimeIsValid(string timespanText, TimeAccuracy timeAccuracy, string expectedDelta)
        {
            var sut  = new PreciseDeltaFormatter(timeAccuracy);
            var time = TimeSpan.Parse(timespanText);

            var formattedTime = sut.Format(time);

            Assert.Equal(expectedDelta, formattedTime);
        }
        public Component()
        {
            Settings    = new Settings();
            Model       = new TimerModel();
            Connections = new List <Connection>();

            DeltaFormatter     = new PreciseDeltaFormatter(TimeAccuracy.Hundredths);
            SplitTimeFormatter = new RegularTimeFormatter(TimeAccuracy.Hundredths);

            ContextMenuControls = new Dictionary <String, Action>();
            ContextMenuControls.Add("Start Server", Start);
        }
Example #4
0
        public void TestPreciseDeltaFormatter(string timespanText, TimeAccuracy timeAccuracy, string expected)
        {
            var formatter = new PreciseDeltaFormatter(timeAccuracy);

            TimeSpan?time = null;

            if (timespanText != null)
            {
                time = TimeSpan.Parse(timespanText);
            }

            string formatted = formatter.Format(time);

            Assert.AreEqual(expected, formatted);
        }
Example #5
0
        public ServerComponent(LiveSplitState state)
        {
            Settings = new Settings();
            Model    = new TimerModel();

            DeltaFormatter     = new PreciseDeltaFormatter(TimeAccuracy.Hundredths);
            SplitTimeFormatter = new RegularTimeFormatter(TimeAccuracy.Hundredths);

            ContextMenuControls = new Dictionary <string, Action>();
            ContextMenuControls.Add("Start Server (WS)", Start);

            State = state;
            Form  = state.Form;

            Model.CurrentState = State;
            State.OnStart     += State_OnStart;
        }