Skip to content

Commit f55bdab

Browse files
committed
Trying it out
1 parent d0406ac commit f55bdab

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-preview-20170923-02" />
15+
<PackageReference Include="roundhouse.lib" Version="0.8.9-PullRequest.294" />
1516
<PackageReference Include="xunit" Version="2.3.0" />
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
@@ -39,7 +40,17 @@ static SliceFixture()
3940
_checkpoint = new Checkpoint();
4041
}
4142

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

4455
public static async Task ExecuteScopeAsync(Func<IServiceProvider, Task> action)
4556
{

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)