public static bool HasLowerCompatibleVersionWithSameMajor(NuGetVersion nugetVersion, IEnumerable <string> compatibleNugetVersions) { return(compatibleNugetVersions.Any(v => nugetVersion.IsGreaterThanOrEqualTo(v) && nugetVersion.HasSameMajorAs(v) )); }
public static bool IsGreaterThanOrEqualTo(this NuGetVersion thisVersion, string otherVersion) { if (NuGetVersion.TryParse(otherVersion, out var validOtherVersion)) { return(validOtherVersion.IsZeroVersion() || thisVersion.IsGreaterThanOrEqualTo(validOtherVersion)); } return(false); }
public void IsGreaterThanOrEqualTo_Returns_Correct_Value(string versionToCompare, bool expectedResult) { var actualResult = _nugetVersion.IsGreaterThanOrEqualTo(versionToCompare); Assert.AreEqual(expectedResult, actualResult); }