Пример #1
0
        /// <summary>
        /// Asserts that an <see cref="HttpRequestMessage"/> sent to the self-hosted HTTP <paramref name="serviceSingleton"/>
        /// results in the actual <see cref="HttpResponseMessage"/> given by the <paramref name="onGetActualResponse"/> <see cref="Action<>"/>.
        /// </summary>
        /// <param name="serviceSingleton">The singleton for the self-hosted HTTP service. Should not be <c>null</c>.</param>
        /// <param name="behavior">The <see cref="HttpBehavior"/> to use with the HTTP service.</param>
        /// <param name="binding">The <see cref="HttpBinding"/> to use with the HTTP service.</param>
        /// <param name="request">The <see cref="HttpRequestMessage"/> instance to send to the self-hosted HTTP service. Should not be <c>null</c>.</param>
        /// <param name="onGetActualResponse">The actual <see cref="HttpResponseMessage"/> instance provided as an <see cref="Action<>"/>. Should not be <c>null</c>.</param>
        public static void Execute(object serviceSingleton, HttpBehavior behavior, HttpBinding binding, HttpRequestMessage request, Action <HttpResponseMessage> onGetActualResponse)
        {
            Assert.IsNotNull(serviceSingleton, "The 'serviceSingleton' parameter should not be null.");
            Assert.IsNotNull(request, "The 'request' parameter should not be null.");
            Assert.IsNotNull(onGetActualResponse, "The 'onGetActualResponse' parameter should not be null.");

            ServiceHostAssert.Execute((baseAddress) => GetServiceHost(serviceSingleton, behavior, binding, baseAddress), request, onGetActualResponse);
        }
Пример #2
0
        /// <summary>
        /// Asserts that an <see cref="HttpRequestMessage"/> sent to the self-hosted HTTP <paramref name="serviceType"/>
        /// results in a response that is equivalent to the expected <see cref="HttpResponseMessage"/>.
        /// </summary>
        /// <param name="serviceType">The service type to use for the self-hosted HTTP service. Should not be <c>null</c>.</param>
        /// <param name="behavior">The <see cref="HttpBehavior"/> to use with the HTTP service.</param>
        /// <param name="binding">The <see cref="HttpBinding"/> to use with the HTTP service.</param>
        /// <param name="request">The <see cref="HttpRequestMessage"/> instance to send to the self-hosted HTTP service. Should not be <c>null</c>.</param>
        /// <param name="expectedResponse">The expected <see cref="HttpResponseMessage"/>. Should not be <c>null</c>.</param>
        public static void Execute(Type serviceType, HttpBehavior behavior, HttpBinding binding, HttpRequestMessage request, HttpResponseMessage expectedResponse)
        {
            Assert.IsNotNull(serviceType, "The 'serviceType' parameter should not be null.");
            Assert.IsNotNull(request, "The 'request' parameter should not be null.");
            Assert.IsNotNull(expectedResponse, "The 'expectedResponse' parameter should not be null.");

            ServiceHostAssert.Execute((baseAddress) => GetServiceHost(serviceType, behavior, binding, baseAddress), request, expectedResponse);
        }