public void CheckSrcMLFilesForNewCPPProject(bool flag) { SrcMLArchive archive = srcMLService.GetSrcMLArchive(); Assert.IsNotNull(archive, "GetSrcMLArchive returned null."); string addedCPPProjectFolder = Path.Combine(testFileTemplateFolder, @"ConsoleApplication1\ConsoleApplication1"); string sourcePath1 = Path.Combine(addedCPPProjectFolder, "stdafx.cpp"); string sourcePath2 = Path.Combine(addedCPPProjectFolder, "stdafx.h"); string sourcePath3 = Path.Combine(addedCPPProjectFolder, "targetver.h"); string sourcePath4 = Path.Combine(addedCPPProjectFolder, "ConsoleApplication1.cpp"); string srcMLPath1 = archive.GetXmlPathForSourcePath(sourcePath1); string srcMLPath2 = archive.GetXmlPathForSourcePath(sourcePath2); string srcMLPath3 = archive.GetXmlPathForSourcePath(sourcePath3); string srcMLPath4 = archive.GetXmlPathForSourcePath(sourcePath4); if (flag) //add { Assert.IsTrue(File.Exists(sourcePath1), "The source file [" + sourcePath1 + "] does not exist."); Assert.IsTrue(File.Exists(sourcePath2), "The source file [" + sourcePath2 + "] does not exist."); Assert.IsTrue(File.Exists(sourcePath3), "The source file [" + sourcePath3 + "] does not exist."); Assert.IsTrue(File.Exists(sourcePath4), "The source file [" + sourcePath4 + "] does not exist."); Assert.IsTrue(File.Exists(srcMLPath1), "The srcML file [" + srcMLPath1 + "] does not exist."); Assert.IsTrue(File.Exists(srcMLPath2), "The srcML file [" + srcMLPath2 + "] does not exist."); Assert.IsTrue(File.Exists(srcMLPath3), "The srcML file [" + srcMLPath3 + "] does not exist."); Assert.IsTrue(File.Exists(srcMLPath4), "The srcML file [" + srcMLPath4 + "] does not exist."); Assert.AreEqual(new FileInfo(sourcePath1).LastWriteTime, new FileInfo(srcMLPath1).LastWriteTime); Assert.AreEqual(new FileInfo(sourcePath2).LastWriteTime, new FileInfo(srcMLPath2).LastWriteTime); Assert.AreEqual(new FileInfo(sourcePath3).LastWriteTime, new FileInfo(srcMLPath3).LastWriteTime); Assert.AreEqual(new FileInfo(sourcePath4).LastWriteTime, new FileInfo(srcMLPath4).LastWriteTime); XElement xelement1 = srcMLService.GetXElementForSourceFile(sourcePath1); XElement xelement2 = srcMLService.GetXElementForSourceFile(sourcePath2); XElement xelement3 = srcMLService.GetXElementForSourceFile(sourcePath3); XElement xelement4 = srcMLService.GetXElementForSourceFile(sourcePath4); Assert.IsNotNull(xelement1, "GetXElementForSourceFile returned null."); Assert.IsNotNull(xelement2, "GetXElementForSourceFile returned null."); Assert.IsNotNull(xelement3, "GetXElementForSourceFile returned null."); Assert.IsNotNull(xelement4, "GetXElementForSourceFile returned null."); } else //remove { Assert.IsFalse(File.Exists(srcMLPath1), "The srcML file [" + srcMLPath1 + "] still exists."); Assert.IsFalse(File.Exists(srcMLPath2), "The srcML file [" + srcMLPath2 + "] still exists."); Assert.IsFalse(File.Exists(srcMLPath3), "The srcML file [" + srcMLPath3 + "] still exists."); Assert.IsFalse(File.Exists(srcMLPath4), "The srcML file [" + srcMLPath4 + "] still exists."); } }
public void CheckCPPSolutionStartup() { SrcMLArchive archive = srcMLService.GetSrcMLArchive(); Assert.IsNotNull(archive, "GetSrcMLArchive returned null."); string sourcePath1 = Path.Combine(testCPPProjectFolder, "stdafx.cpp"); string sourcePath2 = Path.Combine(testCPPProjectFolder, "stdafx.h"); string sourcePath3 = Path.Combine(testCPPProjectFolder, "targetver.h"); string sourcePath4 = Path.Combine(testCPPProjectFolder, "TestCPPSolution.cpp"); string srcMLPath1 = archive.GetXmlPathForSourcePath(sourcePath1); string srcMLPath2 = archive.GetXmlPathForSourcePath(sourcePath2); string srcMLPath3 = archive.GetXmlPathForSourcePath(sourcePath3); string srcMLPath4 = archive.GetXmlPathForSourcePath(sourcePath4); Assert.IsTrue(File.Exists(sourcePath1), "The source file [" + sourcePath1 + "] does not exist."); Assert.IsTrue(File.Exists(sourcePath2), "The source file [" + sourcePath2 + "] does not exist."); Assert.IsTrue(File.Exists(sourcePath3), "The source file [" + sourcePath3 + "] does not exist."); Assert.IsTrue(File.Exists(sourcePath4), "The source file [" + sourcePath4 + "] does not exist."); Assert.IsTrue(File.Exists(srcMLPath1), "The srcML file [" + srcMLPath1 + "] does not exist."); Assert.IsTrue(File.Exists(srcMLPath2), "The srcML file [" + srcMLPath2 + "] does not exist."); Assert.IsTrue(File.Exists(srcMLPath3), "The srcML file [" + srcMLPath3 + "] does not exist."); Assert.IsTrue(File.Exists(srcMLPath4), "The srcML file [" + srcMLPath4 + "] does not exist."); Assert.AreEqual(new FileInfo(sourcePath1).LastWriteTime, new FileInfo(srcMLPath1).LastWriteTime); Assert.AreEqual(new FileInfo(sourcePath2).LastWriteTime, new FileInfo(srcMLPath2).LastWriteTime); Assert.AreEqual(new FileInfo(sourcePath3).LastWriteTime, new FileInfo(srcMLPath3).LastWriteTime); Assert.AreEqual(new FileInfo(sourcePath4).LastWriteTime, new FileInfo(srcMLPath4).LastWriteTime); XElement xelement1 = srcMLService.GetXElementForSourceFile(sourcePath1); XElement xelement2 = srcMLService.GetXElementForSourceFile(sourcePath2); XElement xelement3 = srcMLService.GetXElementForSourceFile(sourcePath3); XElement xelement4 = srcMLService.GetXElementForSourceFile(sourcePath4); Assert.IsNotNull(xelement1, "GetXElementForSourceFile returned null."); Assert.IsNotNull(xelement2, "GetXElementForSourceFile returned null."); Assert.IsNotNull(xelement3, "GetXElementForSourceFile returned null."); Assert.IsNotNull(xelement4, "GetXElementForSourceFile returned null."); string sourcePathX = Path.Combine(testCSharpProjectFolder, "AlreadyDeletedClass1.cpp"); XElement xelementX = srcMLService.GetXElementForSourceFile(sourcePathX); Assert.IsNull(xelementX, "GetXElementForSourceFile returned not null."); }
public void CheckCSharpSolutionStartup() { SrcMLArchive archive = srcMLService.GetSrcMLArchive(); Assert.IsNotNull(archive, "GetSrcMLArchive returned null."); string sourcePath = Path.Combine(testCSharpProjectFolder, "Class1.cs"); string srcMLPath = archive.GetXmlPathForSourcePath(sourcePath); Assert.IsTrue(File.Exists(sourcePath), "The source file [" + sourcePath + "] does not exist."); Assert.IsTrue(File.Exists(srcMLPath), "The srcML file [" + srcMLPath + "] does not exist."); Assert.AreEqual(new FileInfo(sourcePath).LastWriteTime, new FileInfo(srcMLPath).LastWriteTime); XElement xelement = srcMLService.GetXElementForSourceFile(sourcePath); Assert.IsNotNull(xelement, "GetXElementForSourceFile returned null."); string sourcePathX = Path.Combine(testCSharpProjectFolder, "AlreadyDeletedClass1.cs"); XElement xelementX = srcMLService.GetXElementForSourceFile(sourcePathX); Assert.IsNull(xelementX, "GetXElementForSourceFile returned not null."); }
public void CheckSrcMLFilesForNewCSharpProject(bool flag) { SrcMLArchive archive = srcMLService.GetSrcMLArchive(); Assert.IsNotNull(archive, "GetSrcMLArchive returned null."); string addedCSharpProjectFolder = Path.Combine(testFileTemplateFolder, @"ClassLibrary1\ClassLibrary1"); string sourcePath1 = Path.Combine(addedCSharpProjectFolder, "Class1.cs"); string srcMLPath1 = archive.GetXmlPathForSourcePath(sourcePath1); if (flag) //add { Assert.IsTrue(File.Exists(sourcePath1), "The source file [" + sourcePath1 + "] does not exist."); Assert.IsTrue(File.Exists(srcMLPath1), "The srcML file [" + srcMLPath1 + "] does not exist."); Assert.AreEqual(new FileInfo(sourcePath1).LastWriteTime, new FileInfo(srcMLPath1).LastWriteTime); XElement xelement1 = srcMLService.GetXElementForSourceFile(sourcePath1); Assert.IsNotNull(xelement1, "GetXElementForSourceFile returned null."); } else //remove { Assert.IsFalse(File.Exists(srcMLPath1), "The srcML file [" + srcMLPath1 + "] still exists."); } }
public void CheckSrcMLFiles() { string sourcePath = fera.FilePath; string oldSourcePath = fera.OldFilePath; FileEventType type = fera.EventType; bool hasSrcML = fera.HasSrcML; if (type == FileEventType.FileAdded || type == FileEventType.FileChanged) { Assert.IsTrue((receivedFileAdded || receivedFileUpdated)); if (hasSrcML) { SrcMLArchive archive = srcMLService.GetSrcMLArchive(); Assert.IsNotNull(archive, "GetSrcMLArchive returned null."); string srcMLPath = archive.GetXmlPathForSourcePath(sourcePath); ////WriteLog(logFilePath, "Adding/Updating srcMLPath = " + srcMLPath); Assert.IsTrue(File.Exists(srcMLPath), "The srcML file [" + srcMLPath + "] does not exist."); Assert.AreEqual(new FileInfo(sourcePath).LastWriteTime, new FileInfo(srcMLPath).LastWriteTime); XElement xelement = srcMLService.GetXElementForSourceFile(sourcePath); Assert.IsNotNull(xelement, "GetXElementForSourceFile returned null."); } } else if (type == FileEventType.FileDeleted) { Assert.IsTrue(receivedFileDeleted); SrcMLArchive archive = srcMLService.GetSrcMLArchive(); Assert.IsNotNull(archive, "GetSrcMLArchive returned null."); string srcMLPath = archive.GetXmlPathForSourcePath(sourcePath); ////WriteLog(logFilePath, "Deleting srcMLPath = " + srcMLPath); Assert.IsFalse(File.Exists(srcMLPath), "The srcML file [" + srcMLPath + "] still exists."); XElement xelementX = srcMLService.GetXElementForSourceFile(sourcePath); Assert.IsNull(xelementX, "GetXElementForSourceFile returned not null."); } receivedFileAdded = receivedFileUpdated = receivedFileDeleted = false; fera = null; }