public void InterceptorMethodsAreCalledOnceWithGet() { // Arrange var interceptor = new RegisterInterceptor(); Session.RequestInterceptors.Add(interceptor); var request = Session.Bind(VerifiedMethodDossierTemplate, new { method = "GET", id = 8 }); // Act using (request.Get()) { // Assert Assert.AreEqual(1, interceptor.MethodSet_Called); Assert.AreEqual(1, interceptor.Headersready_Called); Assert.AreEqual(1, interceptor.DataSent_Called); } }
public async Task InterceptorMethodsAreCalledOnceWithNoBody_Async() { // Arrange var interceptor = new RegisterInterceptor(); Session.RequestInterceptors.Add(interceptor); var request = Session.Bind(VerifiedMethodDossierTemplate, new { method = "POST", id = 8 }).AsJson(); // Act using (await request.Async().Post()) { // Assert Assert.AreEqual(1, interceptor.MethodSet_Called); Assert.AreEqual(1, interceptor.Headersready_Called); Assert.AreEqual(1, interceptor.DataSent_Called); } }
public void InterceptorMethodsAreCalledOnceWithGet_AsyncEvent() { // Arrange var interceptor = new RegisterInterceptor(); Session.RequestInterceptors.Add(interceptor); var request = Session.Bind(VerifiedMethodDossierTemplate, new { method = "GET", id = 8 }); // Act TestAsyncEvent(wh => { request.AsyncEvent() .OnComplete(() => wh.Set()) .Get(response => { }); }); Assert.AreEqual(1, interceptor.MethodSet_Called); Assert.AreEqual(1, interceptor.Headersready_Called); Assert.AreEqual(1, interceptor.DataSent_Called); }