I'm new to WCF. I've created a basic service and engineer tested it with the debugger and WCFTestClient. I've never written my own WCF client. Now I need to build unit tests for the service.
My classes:
IXService
CXService
CServiceLauncher
(Yes, I know the C prefix does not meet current standards, but it is required by my client's standards.)
My service functionality can be tested directly against XService
, but I need to test CServiceLauncher
as well. All I want to do is connect to a URI and discover if there is a service running there and what methods it offers.
Other questions I read:
- AddressAccessDeniedException "Your process does not have access rights to this namespace" when Unit testing WCF service - starts service host in unit test
- WCF Unit Test - recommends hosting the service in unit test, makes a vague reference to connecting to service via HTTP
- WCF MSMQ Unit testing - references MSMQ, which is more detailed than I need
- Unit test WCF method - I never knew I could auto generate tests, but the system isn't smart enough to know what to assert.
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 us nothing about the service");
}
finally
{
target.StopUi();
}
}