public void TestMethod1() { ITestInterface service = ServiceLocator.GetInstance <ITestInterface>(); Assert.IsNotNull(service); service.TestMethod("Hello world!"); }
public static async Task AsyncMain() { ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true; ITestInterface apiInterface = TypeSafeHttpBuilder <ITestInterface> .Create() .RegisterRestSharpClient(@"http://localhost.fiddler:5000") .RegisterDefaultSerializers() .RegisterJsonNetSerializer() .Build(); Console.WriteLine("About to call intercepted method."); Task <TestReturnModel> result = apiInterface.TestMethod("test", "testing dynamic header value"); Console.WriteLine("API method temporarily yielded."); await result; Console.WriteLine($"Finished call intercepted method. Result: {result.Result.ReturnValue}"); }
public static async Task AsyncMain() { ITestInterface apiInterface = TypeSafeHttpBuilder <ITestInterface> .Create() .RegisterDotNetHttpClient(@"https://localhost:5001", new HttpClientHandler() { SslProtocols = SslProtocols.Tls, ServerCertificateCustomValidationCallback = (message, certificate2, arg3, arg4) => true }) .RegisterDefaultSerializers() .RegisterJsonNetSerializer() .Build(); Console.WriteLine("About to call intercepted method."); Task <TestReturnModel> result = apiInterface.TestMethod(new TestModel(12456, "Two"), "test"); Console.WriteLine("API method temporarily yielded."); await result; Console.WriteLine($"Finished call intercepted method. Result: {result.Result.ReturnValue}"); }