Reputation: 137
I have referenced my WPF project to an NUnit Test Project I made. I am trying to call a function of it but I get the following compilation error:
Reference to type 'DependencyObject' claims it is defined in 'WindowsBase', but it could not be found
I have added PresentationFramework, PresentationCore and WindowsBase as references in the "Assemblies" section of the NUnit test but no go... Not sure what I'm doing wrong... the code is very basic...
using NUnit.Framework;
using System.Collections.Generic;
using System.Threading;
using CM;
namespace Tests
{
[TestFixture, Apartment(ApartmentState.STA)]
public class Tests
{
InstUserControl userControlMV = new InstUserControl ();
[Test]
public void Test1()
{
List<string> pOptions = new List<string>() { "2x4", "4x6" };
userControlMV.SetPOptions(pOptions);
Assert.Pass();
}
}
}
Anyone know what I'm doing wrong.
Upvotes: 0
Views: 2708
Reputation: 169190
You cannot create a NUnit Test Project (.NET Core)
to test a WPF application that targets the .NET Framework. Here is what you should do:
Unit Test Project (.NET Framwork)
NUnit
and NUnit3TestAdapter
NuGet packages into itUpvotes: 2