c# - NUnit: Unit Testing Entity Framework ViewModel in WPF MVVM? -


I'm just starting with the full basic elements of the unit test I have used the initial tutorials as a guideline.

Here is my test model, which contains a method that performs a Linux query with EF. The class is in the same project as my application for now.

  Namespace diiInteelments. Tests [{TestFeacense] Public Class Entitelmeigmodel Tests: Notification Messages {Entitlement Entactions _contact = New Entitlement Entity (); Private Observation Closure & lt; VwAccountHeader & gt; _accountHeaderCollection; Public Supervision Collection & lt; VwAccountHeader & gt; Account Header Collection {Return _accountHeaderCollection; } Set {_accountHeaderCollection = value; OnPropertyChanged ("AccountHeaderCollection"); }} [Test] Public Zero GetAccountHeaders () {var query = Select one of the _context.vwAccountHeaders; AccountHeaderCalution = New Observation Collection & lt; VwAccountHeader & gt; (Query); }}   

When I run a test in NUnit, I get the following exception:

" No connection called 'EntitlementEntities' is found in the string application Config file ""

is now possible because the .nunit test string in the app.config Can not use the project?

Is there a work for this & is this the best way or should I look into the DB joke for testing?

You are receiving the error because you do not have a connection string in the unit test project.

As a joke, it depends on your wish; Usually, on unit testing, you only examine the business code and you copy the integration points (database, web service etc.) If you need to test, from the presentation level to the database, So you have an integration test, and you do not need to fake.

Hope it helps.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -