little-aspnetcore-todo icon indicating copy to clipboard operation
little-aspnetcore-todo copied to clipboard

Errors trying to run tests.

Open wdwinslow opened this issue 6 years ago • 5 comments

First - thanks so much for such a great free learning resource!

I'm a C# / .Net noob, so please take this worth a grain of salt. Entirely possible I missed something somewhere. However, I had to edit my .csproj files manually to add some references in order to get the tests to work.

According to dotnet --version I'm on 2.1.104. I'm using VS Code as my editor. Here is what I added to get the tests to run.

Project: AspNetCoreTodo.UnitTests Added these lines to AspNetCoreTodo.UnitTests.csproj

<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.2" PrivateAssets="All" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.2" />

Project: AspNetCoreTodo.IntegrationTests Added this line to AspNetCoreTodo.IntegrationTests.csproj <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />

Hope this is helpful. Thanks again!

wdwinslow avatar Jan 01 '19 22:01 wdwinslow

Hey @wdwinslow, are you creating these projects from scratch (following the book), or cloning this repository and trying to build the cloned code?

Glad the resource is useful! Sorry I haven't had a chance to update it to .NET Core 2.1+ yet.

nbarbettini avatar Jan 02 '19 00:01 nbarbettini

I was creating from scratch - following the book.

wdwinslow avatar Jan 02 '19 00:01 wdwinslow

I am having trouble too. Looks like the unit tests project is missing some references and not finding ApplicationDbContext or any of the entity stuff

mmzysk avatar Mar 10 '19 05:03 mmzysk

The integration tests were also not working. Using .net core 2.2 It did not like the lines in TestFixture.cs about the Json file. I ended up having to run dotnet add package Microsoft.Extensions.Configuration.Json --version 2.2.0 Now I'm fighting with the directory path

mmzysk avatar Mar 11 '19 02:03 mmzysk

I am having trouble too. Looks like the unit tests project is missing some references and not finding ApplicationDbContext or any of the entity stuff

Im fixit with: dotnet add package Microsoft.EntityFrameworkCore.InMemory

erniker avatar Jun 18 '19 19:06 erniker