@@ -93,6 +93,16 @@ public MvcWebApplicationBuilder<TStartup> UseApplicationAssemblies()
93
93
/// <returns>An instance of this <see cref="MvcWebApplicationBuilder{TStartup}"/></returns>
94
94
public MvcWebApplicationBuilder < TStartup > UseRequestCulture ( string culture , string uiCulture )
95
95
{
96
+ if ( culture == null )
97
+ {
98
+ throw new ArgumentNullException ( nameof ( culture ) ) ;
99
+ }
100
+
101
+ if ( uiCulture == null )
102
+ {
103
+ throw new ArgumentNullException ( nameof ( uiCulture ) ) ;
104
+ }
105
+
96
106
ConfigureBeforeStartup ( services =>
97
107
{
98
108
services . TryAddSingleton ( new TestCulture
@@ -116,6 +126,16 @@ public MvcWebApplicationBuilder<TStartup> UseRequestCulture(string culture, stri
116
126
/// <returns>An instance of this <see cref="MvcWebApplicationBuilder{TStartup}"/></returns>
117
127
public MvcWebApplicationBuilder < TStartup > UseStartupCulture ( string culture , string uiCulture )
118
128
{
129
+ if ( culture == null )
130
+ {
131
+ throw new ArgumentNullException ( nameof ( culture ) ) ;
132
+ }
133
+
134
+ if ( uiCulture == null )
135
+ {
136
+ throw new ArgumentNullException ( nameof ( uiCulture ) ) ;
137
+ }
138
+
119
139
_systemCulture = new TestCulture { Culture = culture , UICulture = uiCulture } ;
120
140
return this ;
121
141
}
@@ -130,6 +150,11 @@ public MvcWebApplicationBuilder<TStartup> UseSolutionRelativeContentRoot(
130
150
string solutionRelativePath ,
131
151
string solutionName = "*.sln" )
132
152
{
153
+ if ( solutionRelativePath == null )
154
+ {
155
+ throw new ArgumentNullException ( nameof ( solutionRelativePath ) ) ;
156
+ }
157
+
133
158
var applicationBasePath = AppContext . BaseDirectory ;
134
159
135
160
var directoryInfo = new DirectoryInfo ( applicationBasePath ) ;
@@ -160,6 +185,11 @@ public TestServer Build()
160
185
. UseContentRoot ( ContentRoot )
161
186
. ConfigureServices ( InitializeServices ) ;
162
187
188
+ if ( _systemCulture == null )
189
+ {
190
+ return new TestServer ( builder ) ;
191
+ }
192
+
163
193
var originalCulture = CultureInfo . CurrentCulture ;
164
194
var originalUICulture = CultureInfo . CurrentUICulture ;
165
195
try
0 commit comments