-
Notifications
You must be signed in to change notification settings - Fork 366
Expand file tree
/
Copy pathPackageReferenceTests.cs
More file actions
35 lines (32 loc) · 1.15 KB
/
PackageReferenceTests.cs
File metadata and controls
35 lines (32 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Runtime.Versioning;
using Should;
using Xunit;
namespace ScriptCs.Tests
{
public class PackageReferenceTests
{
public class TheConstructor
{
[Theory]
[InlineData(null, null, null)]
[InlineData("", null, null)]
[InlineData(" ", null, null)]
[InlineData("1.0.1", "1.0.1", null)]
[InlineData("1.0.1-alpha", "1.0.1", "alpha")]
[InlineData("1.0.1-beta-2", "1.0.1", "beta-2")]
public void ParsesVersionAndSpecialVersion(
string version, string expectedVersion, string expectedSpecialVersion)
{
// Arrange, Act
var packageReference = new PackageReference(
"packageId", new FrameworkName(".NETFramework,Version=v4.0"), version);
// Assert
packageReference.Version.ShouldEqual(string.IsNullOrWhiteSpace(expectedVersion)
? new Version()
: new Version(expectedVersion));
packageReference.SpecialVersion.ShouldEqual(expectedSpecialVersion);
}
}
}
}