2 Replies - 157 Views - Last Post: 18 January 2019 - 10:02 AM

#1 fearfulsc2   User is offline

  • D.I.C Head

Reputation: 15
  • View blog
  • Posts: 243
  • Joined: 25-May 16

Unit Test Web Service .NET Core

Posted 18 January 2019 - 09:55 AM

Hi everyone,

I am trying to write unit tests for a service that calls a SOAP service.

I tried creating an interface for it using the wsdl command in the cmd prompt.

It generates a file for me that has the interface for me.

However, it's for the .NET framework, so some of the namespaces that are in it are not part of .NET Core and I am having a compiling error.

Has anyone here worked on Mocking/Unit Testing a connected service so that we don't actually call the real service?

Is This A Good Question/Topic? 0
  • +

Replies To: Unit Test Web Service .NET Core

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14865
  • View blog
  • Posts: 59,306
  • Joined: 12-June 08

Re: Unit Test Web Service .NET Core

Posted 18 January 2019 - 09:58 AM

Like MOQ?

https://www.nuget.org/packages/Moq/
http://dontcodetired...-Tests-with-Moq
Was This Post Helpful? 0
  • +
  • -

#3 fearfulsc2   User is offline

  • D.I.C Head

Reputation: 15
  • View blog
  • Posts: 243
  • Joined: 25-May 16

Re: Unit Test Web Service .NET Core

Posted 18 January 2019 - 10:02 AM

Yes, like Moq.

I don't want to actually call the SOAP service since this is a unit test and not an integration test. When I added the connected service in Visual Studio 2017, it creates a References.cs class for that connected service.

I wanted to Mock the contents of that file so that the service is never actually called when I create my unit tests.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1