Beispiel #1
0
        public void ConvertsUnknownTimeControlCorrectly()
        {
            var gtc = TimeControlConverters.TimeControlFromTimeControlString(UnknownTimeControl);

            Assert.Single(gtc.TimeControlParts);
            Assert.IsType <UnknownTimeControlPart>(gtc.TimeControlParts[0]);
            var gtcString = TimeControlConverters.ToStandardTimeControlString(gtc);

            Assert.Equal(UnknownTimeControl, gtcString);
        }
Beispiel #2
0
        public void ConvertsSuddenDeathTimeControlCorrectly()
        {
            var gtc = TimeControlConverters.TimeControlFromTimeControlString(SuddenDeathTimeControl);

            Assert.Single(gtc.TimeControlParts);
            Assert.IsType <SuddenDeathTimeControlPart>(gtc.TimeControlParts[0]);
            var suddenDeath = (SuddenDeathTimeControlPart)gtc.TimeControlParts.First();

            Assert.Equal(5, suddenDeath.TotalDuration.Minutes);
            var gtcString = TimeControlConverters.ToStandardTimeControlString(gtc);

            Assert.Equal(SuddenDeathTimeControl, gtcString);
        }
Beispiel #3
0
        public void ConvertsHourglassControlCorrectly()
        {
            var gtc = TimeControlConverters.TimeControlFromTimeControlString(HourglassTimeControl);

            Assert.Single(gtc.TimeControlParts);
            Assert.IsType <HourglassTimeControlPart>(gtc.TimeControlParts[0]);
            var hourglass = (HourglassTimeControlPart)gtc.TimeControlParts.First();

            Assert.Equal(1, hourglass.TotalDuration.Minutes);
            var gtcString = TimeControlConverters.ToStandardTimeControlString(gtc);

            Assert.Equal(HourglassTimeControl, gtcString);
        }
Beispiel #4
0
        public void ConvertsPeriodTimeControlCorrectly()
        {
            var gtc = TimeControlConverters.TimeControlFromTimeControlString(PeriodTimeControl);

            Assert.Single(gtc.TimeControlParts);
            Assert.IsType <PeriodTimeControlPart>(gtc.TimeControlParts[0]);
            var period = (PeriodTimeControlPart)gtc.TimeControlParts.First();

            Assert.Equal(40, period.Moves);
            Assert.Equal(1, period.PeriodDuration.Hours);
            var gtcString = TimeControlConverters.ToStandardTimeControlString(gtc);

            Assert.Equal(PeriodTimeControl, gtcString);
        }
Beispiel #5
0
        public void ConvertsIncrementalTimeControlCorrectly()
        {
            var gtc = TimeControlConverters.TimeControlFromTimeControlString(IncrementalTimeControl);

            Assert.Single(gtc.TimeControlParts);
            Assert.IsType <IncrementalTimeControlPart>(gtc.TimeControlParts[0]);
            var incremental = (IncrementalTimeControlPart)gtc.TimeControlParts.First();

            Assert.Equal(3, incremental.TotalDuration.Minutes);
            Assert.Equal(2, incremental.IncrementSeconds);
            var gtcString = TimeControlConverters.ToStandardTimeControlString(gtc);

            Assert.Equal(IncrementalTimeControl, gtcString);
        }
Beispiel #6
0
 /// <summary>
 /// Sets the value of a tag in the format of a <see cref="ResultReason" />.
 /// </summary>
 /// <param name="gameTag">The tag.</param>
 /// <param name="timeControl">The result.</param>
 public static void SetTimeControlValue(this GameTag gameTag, GameTimeControl timeControl) =>
 gameTag.Value = TimeControlConverters.ToStandardTimeControlString(timeControl);