1

I'm using Visual Basic .Net, .NET-Verion 4.6.1, VS 2019 Community.

I want to include Unittests in my project so I istalled NUnit, created a Test-Project, imported the project I want to test, call a class in the project and I get:

SetUp failed for test fixture *Project*_Test.*Class*_Test System.IO.FileNotFoundException : Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system can't find the required file.

So I searched around and installed the Config-Manager with Nuget-Console -> didn't do anything. ... copied the Config-Manager.dll from the project to my test-project -> different fileNotFound exception. This time it wants the next file.

So I debugged and saw, that the error originates on this line of code

Private ReadOnly STR_CONNECTION_STRING As String = DirectCast(New Global.System.Configuration.AppSettingsReader().GetValue("*DB_Conn_String*", GetType(String)), String)

How do I remove this error? The line of code doesn't seem to be the problem, since the test can't find the classes in the first place.

Thx for the help Daedra

1 Answer 1

2

Okay, I spend a good day to figure this out:

If you use .NET-Framework for the project, you want to write tests for, you don't want to go

Add -> New Project -> NUnit Test (.Net-Core)

You run into unlimited problems with .NET-Core vs .NET-Framework.

Instead do

Add -> New Project -> Class-Library (.NET-Framework)

Then go to NuGet and install NUnit and NUnit3TestAdapter.

I simply copied my already written tests and they worked instantly.

Hope this helps someone someday ^~^

Cheers Daedra

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.