Skip to content

Commit 5c24d7f

Browse files
committed
Added WebApplicationAssembly and FullStartupName is now called StartupType (closes #123)
1 parent 1f59bcb commit 5c24d7f

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

samples/MusicStore/MusicStore.Test/TestStartup.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public void ConfigureTestServices(IServiceCollection services)
3636

3737
TestHelper.HttpFeatureRegistrationPlugins.Add(new SessionTestPlugin());
3838

39+
TestHelper.ShouldPassForPlugins.Add(new AbstractionsTestPlugin());
40+
TestHelper.ShouldPassForPlugins.Add(new ControllersTestPlugin());
41+
3942
services
4043
.AddMvcTesting()
4144
.AddRoutingTesting();
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"TestAssemblyName": "MusicStore.Test"
2+
"General": {
3+
"TestAssemblyName": "MusicStore.Test"
4+
}
35
}

src/MyTested.AspNetCore.Mvc.Abstractions/Internal/Application/TestApplication.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,12 @@ internal static Type TryFindDefaultStartupType()
241241
{
242242
var applicationAssembly = Assembly.Load(new AssemblyName(testAssemblyName));
243243

244-
var startupName = TestConfiguration.General.FullStartupName ?? $"{Environment.EnvironmentName}Startup";
244+
var startupType = TestConfiguration.General.StartupType ?? $"{Environment.EnvironmentName}Startup";
245245

246246
// check root of the test project
247247
var startup =
248-
applicationAssembly.GetType(startupName) ??
249-
applicationAssembly.GetType($"{testAssemblyName}.{startupName}");
248+
applicationAssembly.GetType(startupType) ??
249+
applicationAssembly.GetType($"{testAssemblyName}.{startupType}");
250250

251251
return startup;
252252
}

src/MyTested.AspNetCore.Mvc.Configuration/Internal/Configuration/GeneralTestConfiguration.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
public class GeneralTestConfiguration : BaseConfiguration
66
{
7+
private const string WebAssemblyNameConfigKey = "WebAssemblyName";
78
private const string TestAssemblyNameConfigKey = "TestAssemblyName";
89
private const string AutomaticStartupConfigKey = "AutomaticStartup";
9-
private const string FullStartupNameConfigKey = "FullStartupName";
10+
private const string StartupTypeConfigKey = "StartupType";
1011
private const string ApplicationNameConfigKey = "ApplicationName";
1112
private const string EnvironmentNameConfigKey = "Environment";
1213

@@ -15,15 +16,17 @@ public GeneralTestConfiguration(IConfiguration configuration)
1516
{
1617
this.Prefix = "General";
1718
}
19+
20+
public string WebAssemblyName => this.GetValue(WebAssemblyNameConfigKey);
1821

1922
public string TestAssemblyName => this.GetValue(TestAssemblyNameConfigKey);
2023

21-
public string ApplicationName => this.GetValue(ApplicationNameConfigKey);
24+
public bool AutomaticStartup => this.GetValue(AutomaticStartupConfigKey, true);
2225

23-
public string EnvironmentName => this.GetValue(EnvironmentNameConfigKey, "Test");
26+
public string StartupType => this.GetValue(StartupTypeConfigKey);
2427

25-
public bool AutomaticStartup => this.GetValue(AutomaticStartupConfigKey, true);
28+
public string ApplicationName => this.GetValue(ApplicationNameConfigKey);
2629

27-
public string FullStartupName => this.GetValue(FullStartupNameConfigKey);
30+
public string EnvironmentName => this.GetValue(EnvironmentNameConfigKey, "Test");
2831
}
2932
}

0 commit comments

Comments
 (0)