public void IntersectWithWorksCorrectly(GameVersionRange left, GameVersionRange right, GameVersionRange expected) { // Act var result = left.IntersectWith(right); // Assert Assert.That(result, Is.EqualTo(expected)); }
/// <summary> /// If the installed game version is in the given range, /// return the given array without the given parameter, /// otherwise return the array as-is. /// </summary> /// <param name="args">Command line parameters to check</param> /// <param name="crashyKspRange">Game versions that should not use this parameter</param> /// <param name="parameter">The parameter to remove on version match</param> /// <returns> /// args or args minus parameter /// </returns> private string[] filterCmdLineArgs(string[] args, GameVersion installedVersion, GameVersionRange crashyKspRange, string parameter) { var installedRange = installedVersion.ToVersionRange(); if (crashyKspRange.IntersectWith(installedRange) != null && args.Contains(parameter)) { log.DebugFormat( "Parameter {0} found on incompatible KSP version {1}, pruning", parameter, installedVersion.ToString()); return(args.Where(s => s != parameter).ToArray()); } return(args); }