public void TestFailSendWithRetry() { Assert.Throws(typeof(AggregateException), () => { IotApi api = new IotApi(); api .RegisterRetryModule(2, TimeSpan.FromSeconds(1)) .RegisterPersistModule(new Dictionary <string, object>()) .RegisterModule(getDefaultModule(true)); api.Open(new System.Collections.Generic.Dictionary <string, object>()); api.SendAsync(new { Prop1 = 1.2, Prop2 = ":)" }, (result) => { Assert.True(((dynamic)result).Prop1 == 1.2); }, (msgs, err) => { throw err; }, null).Wait(); }); }