private bool CheckGeneratorVersionRequiredByTemplate(string generatorVersionsAllowed) { if (!VersionStringHelpers.TryParseVersionSpecification(generatorVersionsAllowed, out IVersionSpecification versionChecker)) { return(false); } return(versionChecker.CheckIfVersionIsValid(GeneratorVersion)); }
public static bool TryParse(string version, out IVersionSpecification?specification) { if (!VersionStringHelpers.IsVersionWellFormed(version)) { specification = null; return(false); } specification = new ExactVersionSpecification(version); return(true); }
public void VersionParseCompare(string allowed, string proposed, bool expected) { Assert.True(VersionStringHelpers.TryParseVersionSpecification(allowed, out IVersionSpecification checker)); Assert.Equal(expected, checker.CheckIfVersionIsValid(proposed)); }
public void VerifyVersionComparisonTest(string version1, string version2, int?expectedComparison) { Assert.Equal(expectedComparison, VersionStringHelpers.CompareVersions(version1, version2)); }
public void VerifyVersionIsWellFormedCheckerTest(string versionString, bool expectedParseResult) { Assert.Equal(expectedParseResult, VersionStringHelpers.IsVersionWellFormed(versionString)); }
public bool CheckIfVersionIsValid(string versionToCheck) { int?result = VersionStringHelpers.CompareVersions(RequiredVersion, versionToCheck); return(result.HasValue && result.Value == 0); }
public void VerifyVersionParseAndCompareTest(string allowedVersionsString, string proposedVersion, bool expectedValidity) { Assert.True(VersionStringHelpers.TryParseVersionSpecification(allowedVersionsString, out IVersionSpecification checker)); Assert.Equal(expectedValidity, checker.CheckIfVersionIsValid(proposedVersion)); }