public void RequestWithInvalidKey()
        {
            var proxy = ChannelFactory<ISomeService>.CreateChannel(new NetNamedPipeBinding(),
                                                                   new EndpointAddress(address));
            using (proxy as IDisposable)
            {
                var reqMsg = new ContactInfoRequestMessage();
                reqMsg.LicenceKey = "some invalid key";

                ContactInfoResponseMessage respMsg;
                respMsg = proxy.GetContactInfo(reqMsg);
            }
        }
        public void RequestWithValidKey()
        {
            var proxy = ChannelFactory<ISomeService>.CreateChannel(new NetNamedPipeBinding(),
                                                                   new EndpointAddress(address));
            using (proxy as IDisposable)
            {
                var reqMsg = new ContactInfoRequestMessage { LicenceKey = "some valid key" };

                var respMsg = proxy.GetContactInfo(reqMsg);

                Assert.AreEqual("555-555-5555", respMsg.ContactInfo.PhoneNumber);
                Assert.AreEqual("*****@*****.**", respMsg.ContactInfo.EmailAddress);
            }
        }
            public ContactInfoResponseMessage GetContactInfo(ContactInfoRequestMessage reqMsg)
            {
                if (reqMsg.LicenceKey != "some valid key")
                    throw new FaultException<string>("Detail: Invalid license key: " + reqMsg.LicenceKey,
                                                     "Reason: Invalid license key.");

                var respMsg =
                        new ContactInfoResponseMessage();
                respMsg.ContactInfo = new ContactInfo();
                respMsg.ContactInfo.EmailAddress = "*****@*****.**";
                respMsg.ContactInfo.PhoneNumber = "555-555-5555";

                return respMsg;
            }