/// <summary> /// Load expected message sequences /// </summary> private void LoadExpectedSequence() { if (expectedSequenceFilePath == null && expectedMessageList == null) { this.site.Assert.Fail("MessageAnalyzerAdapter.LoadExpectedSequence: ExpectedSequenceFilePath cannot be null"); } if (expectedSequenceFilePath != null && (expectedMessageList == null || expectedSequenceFilePathChanged)) { try { XmlSerializer serializer = new XmlSerializer(typeof(ExpectedMessageList)); using (FileStream fs = new FileStream(expectedSequenceFilePath, FileMode.Open)) { XmlReaderSettings settings = new XmlReaderSettings(); settings.XmlResolver = null; settings.DtdProcessing = DtdProcessing.Prohibit; using (XmlReader reader = XmlReader.Create(fs, settings)) { expectedMessageList = (ExpectedMessageList)serializer.Deserialize(reader); } } if (expectedMessageList.Filter != null) { this.Filter = TranslateFilter(expectedMessageList.Filter); } expectedSequenceFilePathChanged = false; } catch (InvalidOperationException e) { this.site.Assert.Fail("MessageAnalyzerAdapter.LoadExpectedSequence: Error in xml: {0}", e.Message); } } this.site.Log.Add(LogEntryKind.Comment, "MessageAnalyzerAdapter.LoadExpectedSequence: Expected Sequence has been loaded successfully. Filter = {0}", Filter); }
/// <summary> /// Reset the adapter /// </summary> public override void Reset() { base.Reset(); // Reset expected Message List expectedMessageList = null; // Reset filter filter = null; // Reset liveCapture and fileCapture if (liveCapture != null) { liveCapture = null; } if (fileCapture != null) { fileCapture.Dispose(); fileCapture = null; } }