markus / MarkusAutoUpdate / src / NetSparkle.Tests / UtilitiesTests.cs @ d8f5045e
이력 | 보기 | 이력해설 | 다운로드 (2.5 KB)
1 |
using System; |
---|---|
2 |
using Xunit; |
3 |
|
4 |
namespace NetSparkleUnitTests |
5 |
{ |
6 |
public class UtilitiesTests |
7 |
{ |
8 |
[Fact] |
9 |
public void TestGetVersionString() |
10 |
{ |
11 |
var versionString = NetSparkleUpdater.Utilities.GetVersionString(new Version(1, 0, 0, 0)); |
12 |
Assert.Equal("1.0", versionString); |
13 |
versionString = NetSparkleUpdater.Utilities.GetVersionString(new Version(0, 1, 0, 0)); |
14 |
Assert.Equal("0.1", versionString); |
15 |
versionString = NetSparkleUpdater.Utilities.GetVersionString(new Version(1, 1, 0, 0)); |
16 |
Assert.Equal("1.1", versionString); |
17 |
versionString = NetSparkleUpdater.Utilities.GetVersionString(new Version(0, 0, 1, 0)); |
18 |
Assert.Equal("0.0.1", versionString); |
19 |
versionString = NetSparkleUpdater.Utilities.GetVersionString(new Version(1, 1, 1, 1)); |
20 |
Assert.Equal("1.1.1.1", versionString); |
21 |
versionString = NetSparkleUpdater.Utilities.GetVersionString(new Version(1, 0, 0, 1)); |
22 |
Assert.Equal("1.0.0.1", versionString); |
23 |
versionString = NetSparkleUpdater.Utilities.GetVersionString(new Version(1, 0, 1, 0)); |
24 |
Assert.Equal("1.0.1", versionString); |
25 |
versionString = NetSparkleUpdater.Utilities.GetVersionString(new Version(0, 0, 0, 1)); |
26 |
Assert.Equal("0.0.0.1", versionString); |
27 |
} |
28 |
|
29 |
[Fact] |
30 |
public void TestGetAbsoluteURL() |
31 |
{ |
32 |
var abosluteURL = NetSparkleUpdater.Utilities.GetAbsoluteURL("https://example.com/program.exe", "https://example.com/appcast.xml"); |
33 |
Assert.Equal("https://example.com/program.exe", abosluteURL.ToString()); |
34 |
abosluteURL = NetSparkleUpdater.Utilities.GetAbsoluteURL("program.exe", "https://example.com/appcast.xml"); |
35 |
Assert.Equal("https://example.com/program.exe", abosluteURL.ToString()); |
36 |
abosluteURL = NetSparkleUpdater.Utilities.GetAbsoluteURL("program.exe", "https://example.com/subfolder/appcast.xml"); |
37 |
Assert.Equal("https://example.com/subfolder/program.exe", abosluteURL.ToString()); |
38 |
abosluteURL = NetSparkleUpdater.Utilities.GetAbsoluteURL("../program.exe", "https://example.com/subfolder/appcast.xml"); |
39 |
Assert.Equal("https://example.com/program.exe", abosluteURL.ToString()); |
40 |
abosluteURL = NetSparkleUpdater.Utilities.GetAbsoluteURL("./program.exe", "https://example.com/subfolder/appcast.xml"); |
41 |
Assert.Equal("https://example.com/subfolder/program.exe", abosluteURL.ToString()); |
42 |
} |
43 |
} |
44 |
} |