public void GetPreRequisit() { Detector detector = new Detector(); detector.Load(@"..\..\..\SampleDetector\bin\Debug\SampleDetector.dll"); Microsoft.Protocols.TestManager.Detector.Prerequisites prerequisits = detector.GetPrerequisits(); Assert.AreEqual("Summary", prerequisits.Summary, "Verify Summary."); Assert.AreEqual(3, prerequisits.Properties.Count, "Verify propertie number."); }
/// <summary> /// Gets properties required for auto-detection. /// </summary> /// <returns>A PrerequisitView object</returns> public PrerequisitView GetPrerequisits() { Microsoft.Protocols.TestManager.Detector.Prerequisites p = detector.GetPrerequisits(); prerequisits = new PrerequisitView() { Summary = p.Summary, Title = p.Title, Properties = new List <PrerequisitProperty>() }; foreach (var i in p.Properties) { prerequisits.Properties.Add(new PrerequisitProperty() { PropertyName = i.Key, PropertyValues = i.Value }); } return(prerequisits); }
public void TestAsyncDetection() { Detector detector = new Detector(); detector.Load(@"..\..\..\SampleDetector\bin\Debug\SampleDetector.dll"); Microsoft.Protocols.TestManager.Detector.Prerequisites prerequisits = detector.GetPrerequisits(); AutoResetEvent autoEvent = new AutoResetEvent(false); DetectionOutcome outcome = null; detector.BeginDetection((o) => { outcome = o; autoEvent.Set(); } ); autoEvent.WaitOne(); Assert.AreEqual(DetectionStatus.Error, outcome.Status, "Error should occur"); Assert.IsNotNull(outcome.Exception, "Check exception"); }