How to unit test WCF server / client?

I have a WCF server, which is a library assembly. (I write this so that I can make fun of below level). It is called var client helper class, which is in a different assembly. Since the transmitted data is complex and the server must send callbacks to clients, I want to check the WCF code in isolation .

(I'm only interested in the TCP channel or the NamePipe channel)

I do not want to scoff at WCF, since the risk I'm trying to control is the use of WCF.

This is an easy way.

  • Upload my WCF server to a different application domain
    (I can load the WCF server into the main application domain, but then it’s harder for me to prove that the objects were serialized correctly, and not just the pointer moved.)
  • Configure the entire WCF configuration so that the client class can call it (most likely named pipes or TCP).
  • And use it in some nunit tests
  • I would rather not test my modules depending on the configuration file.

I hope (hopefully) that there are some usage classes for setting up WCF unit test, that I can just pass the type of my server class and return the factory client that connects to the server back to me.

I'm wrong about this, for example, is there a better way to test my level of communication and use WCF?

+3
source share
2 answers

, proc, , , , .

- ( proc WCF 4). , , . .

ServiceHost using, , , , . , .

.

+2

SOA Cleaner WCF. http://xyrow.com . , ( , ).

0

Source: https://habr.com/ru/post/1723860/


All Articles