little-aspnetcore-todo
little-aspnetcore-todo copied to clipboard
Errors trying to run tests.
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!
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.
I was creating from scratch - following the book.
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
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
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