-
Notifications
You must be signed in to change notification settings - Fork 793
Expand file tree
/
Copy pathCoreTests.cs
More file actions
73 lines (67 loc) · 2.48 KB
/
CoreTests.cs
File metadata and controls
73 lines (67 loc) · 2.48 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
namespace UniGetUI.Core.Data.Tests
{
public class CoreTests
{
public static object[][] Data =>
[
[CoreData.UniGetUIDataDirectory],
[CoreData.UniGetUIInstallationOptionsDirectory],
[CoreData.UniGetUICacheDirectory_Data],
[CoreData.UniGetUICacheDirectory_Icons],
[CoreData.UniGetUICacheDirectory_Lang],
[CoreData.UniGetUI_DefaultBackupDirectory],
];
[Theory]
[MemberData(nameof(Data))]
public void CheckDirectoryAttributes(string directory)
{
Assert.True(
Directory.Exists(directory),
$"Directory ${directory} does not exist, but it should have been created automatically"
);
}
[Fact]
public void CheckOtherAttributes()
{
Assert.NotEmpty(CoreData.VersionName);
Assert.NotEqual(0, CoreData.BuildNumber);
Assert.NotEqual(0, CoreData.UpdatesAvailableNotificationTag);
Assert.True(
Directory.Exists(CoreData.UniGetUIExecutableDirectory),
"Directory where the executable is located does not exist"
);
Assert.True(
File.Exists(CoreData.UniGetUIExecutableFile),
"The executable file does not exist"
);
}
[Theory]
[InlineData("3.3.7", "3.3.7")]
[InlineData("2026.1.2", "v2026.1.2")]
[InlineData("v2026.1.2", "v2026.1.2")]
public void CheckGitHubReleaseTag(string versionName, string expectedTag)
{
Assert.Equal(expectedTag, CoreData.GetGitHubReleaseTag(versionName));
}
[Fact]
public void CheckGitHubReleaseTagCandidatesForCalendarVersion()
{
Assert.Equal(
["v2026.1.2", "2026.1.2"],
CoreData.GetGitHubReleaseTagCandidates("2026.1.2")
);
}
[Fact]
public void CheckGitHubReleaseUrlsUseEscapedResolvedTag()
{
Assert.Equal(
"https://github.com/Devolutions/UniGetUI/releases/tag/v2026.1.2",
CoreData.GetGitHubReleasePageUrlFromTag(CoreData.GetGitHubReleaseTag("2026.1.2"))
);
Assert.Equal(
"https://api.github.com/repos/Devolutions/UniGetUI/releases/tags/3.3.7-beta1",
CoreData.GetGitHubReleaseApiUrlFromTag("3.3.7-beta1")
);
}
}
}