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); }
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); }
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); }
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); }
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); }
/// <summary> /// Gets the value of a tag in the format of a <see cref="ResultReason" />. /// </summary> /// <param name="gameTag">The tag.</param> /// <returns>The value of the tag as a result reason.</returns> public static GameTimeControl AsTimeControl(this GameTag gameTag) => TimeControlConverters.TimeControlFromTimeControlString(gameTag.Value);