I have a web application with three layers: Web > Services > Core. I've just added a Services.Tests unit tests project and I'm trying to figure out how to get started.
I've added a reference from the Services.Tests project to the Services project. I then created an instance of the Services.service class in my Test class:
[TestClass]
public class CrudTests
{
private readonly SetServices _setService = new SetServices();
[TestMethod]
public void TestMethod()
{
But I got an error about _setService
needing a reference to my Core project.
First question: Why do I need to reference my core project if the Services project already references it?
I've added the reference and ran the empty test, which passed. I then tried to call one of the basic methods within my service class:
[TestMethod]
public void TestMethod()
{
_setService.CreateSet("Test Set", "Test Set Details", null);
But I get a providerIncompatileException
.
Second question: What is the recommended way to create/use a dedicated test database?
Third question: How do I tell my tests project which database to use?