Search code examples
c#.netunit-testingvisual-studio-codenunit

Having issues referencing a class with NUnit testing


I have a directory labeled unit-testing-using-nunit as defined in the Microsoft documentation. My issue is being unable to reference the classes I want to test. I'm still relatively new to .NET so I'm having issues understanding how to properly implement these unit tests.

This is my directory tree

After implementing Usings.cs Usings.cs

I end up with this error: Error

I feel like once I get a hint for how to reference /API/Entities/AppUser.cs I'll be able to take it from there.


Solution

  • You're going to want to add a project reference in Entities.Tests.csproj to the API project like so:

    <ItemGroup>
      <ProjectReference Include="..\..\API\API.csproj" />
    </ItemGroup>