public void OwinCallCancelled(HostType hostType) { using (ApplicationDeployer deployer = new ApplicationDeployer()) { var serverInstance = new NotificationServer(); serverInstance.StartNotificationService(); string applicationUrl = deployer.Deploy(hostType, Configuration); try { Trace.WriteLine(string.Format("Making a request to url : ", applicationUrl)); HttpClient httpClient = new HttpClient(); Task <HttpResponseMessage> response = httpClient.GetAsync(applicationUrl); response.Wait(1 * 1000); httpClient.CancelPendingRequests(); bool receivedNotification = serverInstance.NotificationReceived.WaitOne(20 * 1000); Assert.True(receivedNotification, "CallCancelled CancellationToken was not issued on cancelling the call"); } finally { serverInstance.Dispose(); } } }
public void ApplicationPoolStop(HostType hostType) { var serverInstance = new NotificationServer(); serverInstance.StartNotificationService(); try { using (ApplicationDeployer deployer = new ApplicationDeployer()) { string applicationUrl = deployer.Deploy(hostType, Configuration); Assert.True(HttpClientUtility.GetResponseTextFromUrl(applicationUrl) == "SUCCESS"); if (hostType == HostType.IIS) { string webConfig = deployer.GetWebConfigPath(); string webConfigContent = File.ReadAllText(webConfig); File.WriteAllText(webConfig, webConfigContent); } } bool receivedNotification = serverInstance.NotificationReceived.WaitOne(20 * 1000); Assert.True(receivedNotification, "Cancellation token was not issued on closing host"); } finally { serverInstance.Dispose(); } }
public void CreateLogger(HostType hostType) { using (ApplicationDeployer deployer = new ApplicationDeployer()) { var service = new NotificationServer(); service.StartNotificationService(); string applicationUrl = deployer.Deploy(hostType, CreateLoggerConfiguration); Assert.Equal("SUCCESS", HttpClientUtility.GetResponseTextFromUrl(applicationUrl)); Assert.True(service.NotificationReceived.WaitOne(1 * 2000), "Did not receive all expected traces within expected time"); service.Dispose(); } }