public void InfiniteDeadline() { helper.UnaryHandler = new UnaryServerMethod <string, string>((request, context) => { Assert.AreEqual(DateTime.MaxValue, context.Deadline); return(Task.FromResult("PASS")); }); // no deadline specified, check server sees infinite deadline Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc")); // DateTime.MaxValue deadline specified, check server sees infinite deadline Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(new CallOptions(deadline: DateTime.MaxValue)), "abc")); }
// Test attribute commented out to prevent running as part of the default test suite. //[Test] //[Category("Performance")] public void UnaryCallPerformance() { var profiler = new BasicProfiler(); Profilers.SetForCurrentThread(profiler); helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => { return request; }); var callDetails = helper.CreateUnaryCall(); for(int i = 0; i < 3000; i++) { Calls.BlockingUnaryCall(callDetails, "ABC"); } profiler.Reset(); for(int i = 0; i < 3000; i++) { Calls.BlockingUnaryCall(callDetails, "ABC"); } profiler.Dump("latency_trace_csharp.txt"); }
public async Task UnaryCall() { helper.UnaryHandler = new UnaryServerMethod <string, string>((request, context) => { return(Task.FromResult(request)); }); Assert.AreEqual("ABC", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "ABC")); Assert.AreEqual("ABC", await Calls.AsyncUnaryCall(helper.CreateUnaryCall(), "ABC")); }