public void ReleaseSatisfies(string versionString, string version, bool result) { var comparator = VersionComparator.Parse(versionString); Assert.NotNull(comparator); Assert.Equal(result, comparator.Match(Version.Parse(version))); }
public void ParseReleaseFloating(string versionString, string version, string releasePrefix) { var comparator = VersionComparator.Parse(versionString); Assert.NotNull(comparator); Assert.Equal(VersionFloatBehavior.Prerelease, comparator.FloatBehavior); Assert.Equal(releasePrefix, comparator.ReleasePrefix); }
public void ParseRevisionFloating(string versionString, string version) { var comparator = VersionComparator.Parse(versionString); Assert.NotNull(comparator); Assert.Equal(VersionFloatBehavior.Revision, comparator.FloatBehavior); Assert.Equal(Version.Parse(version), comparator.Version); }
public void ParseTailOperators(string versionString, string op) { var comparator = VersionComparator.Parse(versionString); Assert.NotNull(comparator); Assert.Equal(Version.Parse("1.0"), comparator.Version); Assert.Equal(ParseOperator(op), comparator.Operator); }
public void ParseMajorFloating() { var comparator = VersionComparator.Parse("*"); Assert.NotNull(comparator); Assert.Equal(VersionFloatBehavior.Major, comparator.FloatBehavior); Assert.Equal(VersionOperator.Equal, comparator.Operator); Assert.Equal(new Version(0, 0, 0), comparator.Version); }
public void ParseMissingBoundaryByHyphen(string comparatorString, string boundaryString, bool missingLower) { var comparator = Assert.IsType <VersionComparator>(VersionComparatorFactory.Parse(comparatorString)); var boundary = VersionComparator.Parse(boundaryString); Assert.Equal(boundary.Version, comparator.Version); Assert.Equal(boundary.FloatBehavior, comparator.FloatBehavior); Assert.Equal(boundary.ReleasePrefix, comparator.ReleasePrefix); Assert.Equal(missingLower ? VersionOperator.LessThanEqual : VersionOperator.GreaterThanEqual, comparator.Operator); }
public void ParseVersionByCaret(string comparatorString, string lowerBoundary, string upperBoundary) { var comparator = Assert.IsType <VersionCompositeComparator>(VersionComparatorFactory.Parse(comparatorString)); Assert.Equal(2, comparator.Count); var lowerComparator = Assert.IsType <VersionComparator>(comparator.First()); var upperComparator = Assert.IsType <VersionComparator>(comparator[1]); Assert.Equal(VersionComparator.Parse(lowerBoundary), lowerComparator); Assert.Equal(VersionComparator.Parse(upperBoundary), upperComparator); }
public void ParseByHyphen(string comparatorString, string lowerBoundary, string upperBoundary) { var comparator = Assert.IsType <VersionCompositeComparator>(VersionComparatorFactory.Parse(comparatorString)); Assert.Equal(2, comparator.Count); var lowerComparator = Assert.IsType <VersionComparator>(comparator.First()); var upperComparator = Assert.IsType <VersionComparator>(comparator[1]); var lowerVersion = VersionComparator.Parse(lowerBoundary); var upperVersion = VersionComparator.Parse(upperBoundary); Assert.Equal(lowerVersion.Version, lowerComparator.Version); Assert.Equal(upperVersion.Version, upperComparator.Version); Assert.Equal(lowerVersion.FloatBehavior, lowerComparator.FloatBehavior); Assert.Equal(upperVersion.FloatBehavior, upperComparator.FloatBehavior); Assert.Equal(lowerVersion.ReleasePrefix, lowerComparator.ReleasePrefix); Assert.Equal(upperVersion.ReleasePrefix, upperComparator.ReleasePrefix); Assert.Equal(VersionOperator.GreaterThanEqual, lowerComparator.Operator); Assert.Equal(VersionOperator.LessThanEqual, upperComparator.Operator); }
public void ParseSimpleComparator(string comparatorString) { var comparator = Assert.IsType <VersionComparator>(VersionComparatorFactory.Parse(comparatorString)); Assert.Equal(VersionComparator.Parse(comparatorString), comparator); }
public void ParseMajorAndMinorByTilde(string comparatorString, string boundaryString) { var comparator = Assert.IsType <VersionComparator>(VersionComparatorFactory.Parse(comparatorString)); Assert.Equal(VersionComparator.Parse(boundaryString), comparator); }