public static MockJsRuntimeInvokeHandler AddMockJsRuntime(this TestServiceProvider serviceProvider, JsRuntimeMockMode mode = JsRuntimeMockMode.Loose)
        {
            if (serviceProvider is null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            var result = new MockJsRuntimeInvokeHandler(mode);

            serviceProvider.AddService(result.ToJsRuntime());

            return(result);
        }
        /// <summary>
        /// Create a <see cref="MockHttpMessageHandler"/> and adds it to the
        /// <paramref name="serviceProvider"/> as a <see cref="HttpClient"/>.
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <returns>The <see cref="MockHttpMessageHandler"/>.</returns>
        public static MockHttpMessageHandler AddMockHttp(this TestServiceProvider serviceProvider)
        {
            if (serviceProvider is null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            var mockHttp   = new MockHttpMessageHandler();
            var httpClient = mockHttp.ToHttpClient();

            httpClient.BaseAddress = new Uri("http://example.com");
            serviceProvider.AddService(httpClient);
            return(mockHttp);
        }