-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathUpdateConfigurationTests.cs
More file actions
148 lines (130 loc) · 4.04 KB
/
Copy pathUpdateConfigurationTests.cs
File metadata and controls
148 lines (130 loc) · 4.04 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
using GeneralUpdate.Core.Configuration;
namespace CoreTest.Configuration;
/// <summary>
/// AAAT unit tests for <see cref="UpdateConfiguration"/> — default property values.
/// Covers: all default property values defined in the abstract base class.
/// </summary>
public class UpdateConfigurationTests
{
private class TestableConfig : UpdateConfiguration { }
[Fact]
public void Ctor_AppName_DefaultsToUpdateExe()
{
var config = new TestableConfig();
Assert.Equal("Update.exe", config.UpdateAppName);
}
[Fact]
public void Ctor_MainAppName_DefaultsToClient()
{
var config = new TestableConfig();
Assert.Equal("Client", config.MainAppName);
}
[Fact]
public void Ctor_InstallPath_DefaultsToBaseDirectory()
{
var config = new TestableConfig();
var expected = AppDomain.CurrentDomain.BaseDirectory;
Assert.Equal(expected, config.InstallPath);
}
[Fact]
public void Ctor_UpdateLogUrl_DefaultsToNull()
{
var config = new TestableConfig();
Assert.Null(config.UpdateLogUrl);
}
[Fact]
public void Ctor_AppSecretKey_DefaultsToNull()
{
var config = new TestableConfig();
Assert.Null(config.AppSecretKey);
}
[Fact]
public void Ctor_ClientVersion_DefaultsToVersion()
{
var config = new TestableConfig();
Assert.Equal("1.0.0.0", config.ClientVersion);
}
[Fact]
public void Ctor_Files_DefaultsToNull()
{
var config = new TestableConfig();
Assert.Null(config.Files);
}
[Fact]
public void Ctor_Formats_DefaultsToNull()
{
var config = new TestableConfig();
Assert.Null(config.Formats);
}
[Fact]
public void Ctor_Directories_DefaultsToNull()
{
var config = new TestableConfig();
Assert.Null(config.Directories);
}
[Fact]
public void Ctor_ReportUrl_DefaultsToNull()
{
var config = new TestableConfig();
Assert.Null(config.ReportUrl);
}
[Fact]
public void Ctor_Bowl_DefaultsToNull()
{
var config = new TestableConfig();
Assert.Null(config.Bowl);
}
[Fact]
public void Ctor_Scheme_DefaultsToNull()
{
var config = new TestableConfig();
Assert.Null(config.Scheme);
}
[Fact]
public void Ctor_Token_DefaultsToNull()
{
var config = new TestableConfig();
Assert.Null(config.Token);
}
[Fact]
public void Ctor_DriverDirectory_DefaultsToNull()
{
var config = new TestableConfig();
Assert.Null(config.DriverDirectory);
}
[Fact]
public void AllProperties_CanBeSetAndGet()
{
var config = new TestableConfig
{
UpdateAppName = "MyApp.exe",
MainAppName = "MainApp",
InstallPath = "C:\\MyApp",
UpdateLogUrl = "https://logs.example.com",
AppSecretKey = "secret-key",
ClientVersion = "1.2.3",
Files = new List<string> { "a.dll" },
Formats = new List<string> { ".log" },
Directories = new List<string> { "temp" },
ReportUrl = "https://report.example.com",
Bowl = "Bowl.exe",
Scheme = "https",
Token = "bearer-token",
DriverDirectory = "C:\\Drivers"
};
Assert.Equal("MyApp.exe", config.UpdateAppName);
Assert.Equal("MainApp", config.MainAppName);
Assert.Equal("C:\\MyApp", config.InstallPath);
Assert.Equal("https://logs.example.com", config.UpdateLogUrl);
Assert.Equal("secret-key", config.AppSecretKey);
Assert.Equal("1.2.3", config.ClientVersion);
Assert.Single(config.Files);
Assert.Single(config.Formats);
Assert.Single(config.Directories);
Assert.Equal("https://report.example.com", config.ReportUrl);
Assert.Equal("Bowl.exe", config.Bowl);
Assert.Equal("https", config.Scheme);
Assert.Equal("bearer-token", config.Token);
Assert.Equal("C:\\Drivers", config.DriverDirectory);
}
}