Skip to content

Trying it out #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="roundhouse.lib" Version="0.8.9-PullRequest.294" />
<PackageReference Include="xunit" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0" />
<PackageReference Include="Shouldly" Version="3.0.0-beta0003" />
Expand Down
13 changes: 12 additions & 1 deletion ContosoUniversity.IntegrationTests/SliceFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using roundhouse;
using Respawn;

namespace ContosoUniversity.IntegrationTests
Expand All @@ -35,7 +36,17 @@ static SliceFixture()
_checkpoint = new Checkpoint();
}

public static Task ResetCheckpoint() => _checkpoint.Reset(_configuration.GetConnectionString("DefaultConnection"));
public static Task ResetCheckpoint()
{
var thing = new Migrate();
thing.Set(cfg =>
{
cfg.ConnectionString = _configuration.GetConnectionString("DefaultConnection");
cfg.SqlFilesDirectory = @"..\..\ContosoUniversity\App_Data";
});
thing.Run();
return _checkpoint.Reset(_configuration.GetConnectionString("DefaultConnection"));
}

public static async Task ExecuteScopeAsync(Func<IServiceProvider, Task> action)
{
Expand Down
14 changes: 13 additions & 1 deletion ContosoUniversity/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using AutoMapper;
using Microsoft.AspNetCore.Builder;
Expand Down Expand Up @@ -32,7 +33,18 @@ public void ConfigureServices(IServiceCollection services)
services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

services.AddAutoMapper();
try
{
services.AddAutoMapper();
}
catch (ReflectionTypeLoadException e)
{
foreach (var loaderException in e.LoaderExceptions)
{
Console.WriteLine(loaderException);
}
throw;
}

services.AddMediatR();

Expand Down