This repository has been archived by the owner on Dec 18, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use normalized semantic version in package path/name
- Loading branch information
Showing
3 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
test/Microsoft.Framework.Runtime.Tests/NuGet/SemanticVersionTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
using NuGet; | ||
using Xunit; | ||
|
||
namespace Microsoft.Framework.Runtime.Tests.NuGet | ||
{ | ||
public class SemanticVersionTests | ||
{ | ||
public static IEnumerable<object[]> NormalizedVersionStringTestData | ||
{ | ||
get | ||
{ | ||
yield return new object[] { new SemanticVersion(1, 0, 0, 0), "1.0.0" }; | ||
yield return new object[] { new SemanticVersion(1, 5, 0, 0), "1.5.0" }; | ||
yield return new object[] { new SemanticVersion(1, 5, 1, 0), "1.5.1" }; | ||
yield return new object[] { new SemanticVersion(1, 5, 1, 1), "1.5.1.1" }; | ||
yield return new object[] { new SemanticVersion("1.0"), "1.0.0" }; | ||
yield return new object[] { new SemanticVersion("1.0.0"), "1.0.0" }; | ||
yield return new object[] { new SemanticVersion("1.0.0.0"), "1.0.0" }; | ||
yield return new object[] { new SemanticVersion("1.0.0.2"), "1.0.0.2" }; | ||
yield return new object[] { new SemanticVersion("1.0.0.2-beta"), "1.0.0.2-beta" }; | ||
yield return new object[] { new SemanticVersion("1.0.0.0-beta"), "1.0.0-beta" }; | ||
yield return new object[] { new SemanticVersion("1.0.0-beta"), "1.0.0-beta" }; | ||
} | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(NormalizedVersionStringTestData))] | ||
public void TestGetNormalizeVersionString(SemanticVersion version, string expectation) | ||
{ | ||
Assert.Equal(expectation, version.GetNormalizedVersionString()); | ||
} | ||
} | ||
} |