public void should_return_false_when_left_operand_is_less_than_right_operand() { var ver1 = Semver.Parse("2.0.0"); var ver2 = Semver.Parse("2.9.9"); Assert.False(ver1 >= ver2); }
public void should_display_the_string_value_of_the_normal_version() { var version = "1.2.3-pre+build"; var semver = Semver.Parse(version); Assert.Equal("1.2.3", semver.Version); }
public void should_return_different_codes_for_different_versions() { var code1 = Semver.Parse("1.3.3-beta"); var code2 = Semver.Parse("1.2.3-beta"); Assert.NotEqual(code1.GetHashCode(), code2.GetHashCode()); }
public void should_return_the_same_code_for_equal_versions() { var code1 = Semver.Parse("1.2.3-beta"); var code2 = Semver.Parse("1.2.3-beta"); Assert.Equal(code1.GetHashCode(), code2.GetHashCode()); }
public void should_ignore_build_meta_data() { var code1 = Semver.Parse("1.2.3-beta+build1"); var code2 = Semver.Parse("1.2.3-beta+build2"); Assert.Equal(code1.GetHashCode(), code2.GetHashCode()); }
public void should_display_the_full_version_including_prerelease_and_build_info() { var version = "1.2.3-pre+build"; var semver = Semver.Parse(version); Assert.Equal(version, semver.FullVersion); }
public void should_return_false_when_versions_are_equal() { var ver1 = Semver.Parse("1.2.3-beta"); var ver2 = Semver.Parse("1.2.3-beta"); Assert.False(ver1 != ver2); }
public void should_return_true_when_version_are_not_equal() { var ver1 = Semver.Parse("1.2.3-beta"); var ver2 = Semver.Parse("1.2.3-charlie"); Assert.True(ver1 != ver2); }
public void should_return_false_when_left_operand_is_equal_to_right_operand() { var ver1 = Semver.Parse("2.0.0-beta"); var ver2 = Semver.Parse("2.0.0-beta"); Assert.False(ver1 < ver2); }
public void should_return_true_when_left_operand_is_greater_than_right_operand() { var ver1 = Semver.Parse("2.0.0"); var ver2 = Semver.Parse("1.9.9"); Assert.True(ver1 >= ver2); }
public void should_return_true_when_left_operand_is_equal_to_right_operand() { var ver1 = Semver.Parse("2.0.0"); var ver2 = Semver.Parse("2.0.0"); Assert.True(ver1 >= ver2); }
public void should_parse_a_normal_version_without_prerelease_and_build_info() { var semver = Semver.Parse("1.2.3"); Assert.Equal(1, semver.Major); Assert.Equal(2, semver.Minor); Assert.Equal(3, semver.Patch); }
public void should_return_1_when_args_major_nr_is_less_than_own_major_nr_other_things_equal() { var v1 = Semver.Parse("2.1.0"); var v2 = Semver.Parse("1.1.0"); var compared = v1.CompareTo(v2); Assert.Equal(1, compared); }
public void should_ignore_build_info() { var v1 = Semver.Parse("1.2.3-beta+foo"); var v2 = Semver.Parse("1.2.3-beta"); var areEqual = v1.Equals(v2); Assert.True(areEqual); }
public void should_return_minus_1_when_own_prerelease_has_less_fields_than_other() { var v1 = Semver.Parse("1.2.3-pre"); var v2 = Semver.Parse("1.2.3-pre.1"); var compared = v1.CompareTo(v2); Assert.Equal(-1, compared); }
public void should_return_minus_1_when_self_is_prerelease() { var v1 = Semver.Parse("1.2.3-pre"); var v2 = Semver.Parse("1.2.3"); var compared = v1.CompareTo(v2); Assert.Equal(-1, compared); }
public void should_return_minus_1_when_own_prerelease_is_numeric_and_other_is_alphanum() { var v1 = Semver.Parse("1.2.3-1"); var v2 = Semver.Parse("1.2.3-alpha"); var compared = v1.CompareTo(v2); Assert.Equal(-1, compared); }
public void should_return_minus_1_when_own_numeric_prerelease_is_less_than_other() { var v1 = Semver.Parse("1.2.3-1"); var v2 = Semver.Parse("1.2.3-2"); var compared = v1.CompareTo(v2); Assert.Equal(-1, compared); }
public void should_return_minus_1_when_own_prerelease_is_lexically_less_than_other() { var v1 = Semver.Parse("1.2.3-alpha"); var v2 = Semver.Parse("1.2.3-beta"); var compared = v1.CompareTo(v2); Assert.Equal(-1, compared); }
public void should_return_0_when_versions_are_equal() { var v1 = Semver.Parse("1.2.3"); var v2 = Semver.Parse("1.2.3"); var compared = v1.CompareTo(v2); Assert.Equal(0, compared); }
public void should_ignore_case() { var v1 = Semver.Parse("1.2.3-beta"); var v2 = Semver.Parse("1.2.3-BETA"); var areEqual = v1.Equals(v2); Assert.True(areEqual); }
public void should_return_minus_1_when_args_minor_nr_is_greater_than_own_minor_nr_other_things_equal() { var v1 = Semver.Parse("1.0.0"); var v2 = Semver.Parse("1.1.0"); var compared = v1.CompareTo(v2); Assert.Equal(-1, compared); }
public void should_ignore_case_when_comparing_prereleases() { var v1 = Semver.Parse("1.2.3-alpha"); var v2 = Semver.Parse("1.2.3-ALPHA"); var compared = v1.CompareTo(v2); Assert.Equal(0, compared); }
public void should_return_true_when_versions_are_lexically_equal() { var v1 = Semver.Parse("1.2.3-beta"); var v2 = Semver.Parse("1.2.3-beta"); var areEqual = v1.Equals(v2); Assert.True(areEqual); }
public void should_not_include_build_in_comparison() { var v1 = Semver.Parse("1.2.3+fuu"); var v2 = Semver.Parse("1.2.3+bar"); var compared = v1.CompareTo(v2); Assert.Equal(0, compared); }
public void should_return_false_when_versions_are_not_equal() { var v1 = Semver.Parse("1.2.4-beta"); var v2 = Semver.Parse("1.2.3-beta"); var areEqual = v1.Equals(v2); Assert.False(areEqual); }
public void should_create_a_new_version_with_the_specified_build() { var version = "1.2.3-pre+build"; var semver = Semver.Parse(version); var newSemver = semver.OverrideBuild("new.build"); Assert.Equal("1.2.3-pre+new.build", newSemver.FullVersion); }
public void should_parse_a_version_with_both_prerelease_and_build_info() { var semver = Semver.Parse("1.2.3-beta+master"); Assert.Equal(1, semver.Major); Assert.Equal(2, semver.Minor); Assert.Equal(3, semver.Patch); Assert.Equal("beta", semver.PreRelease); Assert.Equal("master", semver.Build); }
public static void HandleSetAction(setArgs args) { RootVersion = args.version.Length > 0 ? Semver.Parse(args.version) : Semver.NoVersion; var hasBuild = args.build.Length > 0; var scanner = new ProjectScanner(); var projects = scanner.Scan(RootVersion, args.scan); VerboseOut(Verbose.Scanning, "Scan done; found {0} projects", projects.Length); if (args.@override && RootVersion == Semver.NoVersion) { VerboseOut(Verbose.Warning, "No root version set; all versions will be overridden with {0}", Semver.NoVersion); } if (hasBuild) { RootVersion = RootVersion.OverrideBuild(args.build); } if (args.tcbuildno) { Console.Out.WriteLine("##teamcity[buildNumber '{0}']", RootVersion); } foreach (var project in projects) { VerboseOut(Verbose.Version, "Versioning project {0}", project.Name); if (args.@override && RootVersion != Semver.NoVersion) { VerboseOut(Verbose.Version, "Overriding version {0} => {1}", project.Version, RootVersion); project.Version = RootVersion; } if (hasBuild) { VerboseOut(Verbose.Version, "Overriding build {0} => {1}", project.Version.Build, args.build); project.Version = project.Version.OverrideBuild(args.build); } AssemblyVersionSetter.SetVersion(project.AssemlyInfo, project.Version); NuspecVersionSetter.SetVersion(project.Nuspec, project.Version); } }
public void should_trim_starting_whitespace() { var semver = Semver.Parse(" 1.0.0"); Assert.Equal(semver, new Semver(1, 0, 0)); }