Dockson Dockson - 1 month ago 8
C# Question

Can't find project classes/methods in test project

In my namespace

Draughts
I have two projects,
Draughts
and
Draughts.UnitTests
. When I try to access
Draughts
methods/classes in
Draughts.UnitTests
it can't find anything at all. At the top of
Draughts.UnitTests
I put
using Draughts
. Any ideas?

BoardUnitTests.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Draughts;
using NUnit.Framework;

namespace Draughts.UnitTests
{
public class BoardUnitTests
{
private Board GetBoard()
{
return true;
}

[Test]
public void CheckValidBoardPosition_ValidPosition_ReturnsTrue()
{
Assert.AreEqual(1, 1);
}
}
}


In the code above it can't recognize Board which is a class I have defined in
Draughts
.

Here's a screenshot of my solution explorer:

enter image description here

Answer

Probably this is related to one of these things

1) You don't have a reference to Draughts on your unit test project

2) Classes on Draughts are not public so you can't see them outside the project they belongs to