Skip to content

Commit 14a4492

Browse files
committed
Trying it out
1 parent bf7bfdd commit 14a4492

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

ContosoUniversity.IntegrationTests/ContosoUniversity.IntegrationTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
15+
<PackageReference Include="roundhouse.lib" Version="0.8.9-PullRequest.294" />
1516
<PackageReference Include="xunit" Version="2.3.1" />
1617
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0" />
1718
<PackageReference Include="Shouldly" Version="3.0.0-beta0003" />

ContosoUniversity.IntegrationTests/SliceFixture.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.AspNetCore.Hosting;
1010
using Microsoft.Extensions.Configuration;
1111
using Microsoft.Extensions.DependencyInjection;
12+
using roundhouse;
1213
using Respawn;
1314

1415
namespace ContosoUniversity.IntegrationTests
@@ -35,7 +36,17 @@ static SliceFixture()
3536
_checkpoint = new Checkpoint();
3637
}
3738

38-
public static Task ResetCheckpoint() => _checkpoint.Reset(_configuration.GetConnectionString("DefaultConnection"));
39+
public static Task ResetCheckpoint()
40+
{
41+
var thing = new Migrate();
42+
thing.Set(cfg =>
43+
{
44+
cfg.ConnectionString = _configuration.GetConnectionString("DefaultConnection");
45+
cfg.SqlFilesDirectory = @"..\..\ContosoUniversity\App_Data";
46+
});
47+
thing.Run();
48+
return _checkpoint.Reset(_configuration.GetConnectionString("DefaultConnection"));
49+
}
3950

4051
public static async Task ExecuteScopeAsync(Func<IServiceProvider, Task> action)
4152
{

ContosoUniversity/Startup.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Reflection;
45
using System.Threading.Tasks;
56
using AutoMapper;
67
using Microsoft.AspNetCore.Builder;
@@ -32,7 +33,18 @@ public void ConfigureServices(IServiceCollection services)
3233
services.AddDbContext<SchoolContext>(options =>
3334
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
3435

35-
services.AddAutoMapper();
36+
try
37+
{
38+
services.AddAutoMapper();
39+
}
40+
catch (ReflectionTypeLoadException e)
41+
{
42+
foreach (var loaderException in e.LoaderExceptions)
43+
{
44+
Console.WriteLine(loaderException);
45+
}
46+
throw;
47+
}
3648

3749
services.AddMediatR();
3850

0 commit comments

Comments
 (0)