private void CreateNewInterval(IDEEvent e, FileInteractionType classification) { _intervals.Add(_cur = _context.CreateIntervalFromEvent <FileInteractionInterval>(e)); _cur.FileName = e.ActiveDocument.FileName; _cur.Type = classification; TransformerUtils.SetDocumentTypeIfNecessary(_cur, e); // initial }
public void GuessDocumentType_Undefined() { var docName = Names.Document("NotCSharp /Project/SomeFile.abc"); var actual = TransformerUtils.GuessDocumentType(docName, new SST()); Assert.AreEqual(DocumentType.Undefined, actual); }
public void GuessDocumentType_Production() { var docName = Names.Document("CSharp /Project/SomeFile.cs"); var actual = TransformerUtils.GuessDocumentType(docName, new SST()); Assert.AreEqual(DocumentType.Production, actual); }
public void GuessDocumentType_FilenameTest() { var docName = Names.Document("CSharp /TestProject/Test.cs"); var actual = TransformerUtils.GuessDocumentType(docName, new SST()); Assert.AreEqual(DocumentType.FilenameTest, actual); }
public void GuessDocumentType_TestFramework(string methodName) { var docName = Names.Document("CSharp /TestProject/MockHelpers.cs"); var sst = PrepareSST(methodName); var actual = TransformerUtils.GuessDocumentType(docName, sst); Assert.AreEqual(DocumentType.TestFramework, actual); }
public void GuessDocumentType_NotTest(string methodName) { var docName = Names.Document("CSharp /TestProject/Test.cs"); var sst = PrepareSST(methodName); var actual = TransformerUtils.GuessDocumentType(docName, sst); Assert.AreNotEqual(DocumentType.Test, actual); }
public void ProcessEvent(IDEEvent e) { Asserts.That(e.TriggeredAt.HasValue); Asserts.That(e.TerminatedAt.HasValue); /*if (e.TriggeredAt.Value > new DateTime(2016, 08, 19, 19, 17, 38)) * { * Console.WriteLine(); * }*/ if (e.ActiveDocument == null || e.TerminatedAt < _referenceTime) { // TODO include case: doc.Type != "CSharp" return; } if (IsTimedOut(e)) { _cur = null; } // untested ( if (_cur != null && (e is TestRunEvent || HasDocumentChanged(e))) { _context.UpdateDurationForIntervalToThis(_cur, e.TriggeredAt.Value); _cur = null; } // ) var classification = ClassifyEventType(e); if (classification.HasValue) { if (_cur == null) { CreateNewInterval(e, classification.Value); } else { TransformerUtils.SetDocumentTypeIfNecessary(_cur, e); // updates _cur.Project = _context.CurrentProject; // might not be available from the beginning if (_cur.Type == classification.Value) { // extend to max duration _context.UpdateDurationForIntervalToMaximum(_cur, e.TerminatedAt.Value); } else { // cut duration to current trigger point _context.UpdateDurationForIntervalToThis(_cur, e.TriggeredAt.Value); CreateNewInterval(e, classification.Value); } } } }