Exercise: SOAP service unit and integration testing

Software must be tested! SOAP services is no exception to the rule!!

In this exercise you must test a SOAP services like the Calculator service you made in a previous exercise.

To test a SOAP service we can use

Unit testing the SOAP service

The class to be Unit tested is the class that IMPLEMENTS the SOAP service interface (normally the class is called Service1 if you didn't rename).

In the solution where you programmed your SOAP service, add a Unit Test project (like you normally do when you want to Unit test a class).

Unit test the class. Check that your test has a good Code Coverage.

Integration testing the SOAP service

Now we will test the SOAP as a service (not as a simple class). This means that you must run the service (on localhost or in Azure), send a request to the service, and Assert something about the response.

Make a new project (aka solution) in Visual Studio, type Unit Test (yes, we use the Unit Test framework to do integration testing!)

Add a SERVICE reference to the project (like you used to do when you try a SOAP service from a Console Application).

Do the testing like:

        [TestMethod]
        public void IntegrationTestAdd()
        {
            using (Service1Client client = new Service1Client())
            {
                Assert.AreEqual(5, client.Plus(3, 2));
            }
        }