c# - Unit Testing WCF Service is launching -


i'm new wcf. i've created basic service , engineer tested debugger , wcftestclient. i've never written own wcf client. need build unit tests service.

my classes:

ixservice cxservice cservicelauncher 

(yes, know c prefix not meet current standards, required client's standards.)

my service functionality can tested directly against xservice, need test cservicelauncher well. want connect uri , discover if there service running there , methods offers.

other questions read:

test outline:

    public void startuitest()     {         uri baseaddress = new uri("http://localhost:8080/myservice");         string soapaddress = "soap";         iuserinterface target = new cservicelauncher(baseaddress, soapaddress);         try         {             assert.areequal(true, target.startui());             /// @todo assert.istrue(serviceisrunning);             /// @todo assert.istrue(service.exposedmethods.count() > 4);             assert.inconclusive("this tells nothing service");         }                 {             target.stopui();         }     } 

i needed build simple client.

reference: http://webbeyond.blogspot.com/2012/11/wcf-simple-wcf-client-example.html

  1. add service reference test project
  2. add test file:

    using system.servicemodel;

    using mytests.servicereferencenamespace;

code inside try now:

            assert.areequal(true, target.startui());             xserviceclient client = new xserviceclient();             client.getsessionid();             assert.areequal(communicationstate.opened, client.state, "wrong communication state after first call"); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -