private void Exercise(Document document) { var configuration = McAfeeSection.Configuration(); var api = new McAfeeApi(configuration); var service = new McAfeeMalwareService(configuration, api); service.Register(document); Assert.That(document.ContainsProperty("subId"), Is.True); Assert.That(document.ContainsProperty("status"), Is.False); Assert.That(document.ContainsProperty("severity"), Is.False); Poll(service, document, 120); Assert.That(document.ContainsProperty("subId"), Is.True); Assert.That(document.ContainsProperty("status"), Is.True); Assert.That(document.ContainsProperty("severity"), Is.True); var severity = int.Parse(document.GetSeverity()); Assert.That(document.GetStatus(), Is.EqualTo("5")); Assert.That(severity, Is.Not.EqualTo(-2)); Assert.That(severity, Is.Not.GreaterThan(1)); api.Dispose(); }
private void Poll(McAfeeMalwareService service, Document document, int timeoutSeconds) { var timeout = DateTime.Now.AddSeconds(timeoutSeconds); while (service.Poll(document) == ServiceStatus.Processing && DateTime.Now < timeout) { Thread.Sleep(5000); } }