You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by br...@apache.org on 2011/12/31 06:13:38 UTC

svn commit: r1226045 - /incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/NPandayImporterTest.cs

Author: brett
Date: Sat Dec 31 06:13:38 2011
New Revision: 1226045

URL: http://svn.apache.org/viewvc?rev=1226045&view=rev
Log:
make importer test more robust to not copy into source directory and reuse current infrastructure

Modified:
    incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/NPandayImporterTest.cs

Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/NPandayImporterTest.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/NPandayImporterTest.cs?rev=1226045&r1=1226044&r2=1226045&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/NPandayImporterTest.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.ProjectImporter/Engine/src/test/csharp/ImporterTests/NPandayImporterTest.cs Sat Dec 31 06:13:38 2011
@@ -31,50 +31,13 @@ namespace NPanday.ProjectImporter.Import
     [TestFixture]
     public class NPandayImporterTest
     {
-        private String slnFile;
         private String warnMsg = String.Empty;
-        private DirectoryInfo withoutNUnitSource;
-        private DirectoryInfo withoutNUnitTarget;
-        private DirectoryInfo withNUnitSource;
-        private DirectoryInfo withNUnitTarget;
-
-        public NPandayImporterTest()
-        {
-            withoutNUnitSource = new DirectoryInfo(FileUtil.GetBaseDirectory() + "\\src\\test\\resource\\MavenTestProjectWithoutNUnit");
-            withoutNUnitTarget = new DirectoryInfo(FileUtil.GetBaseDirectory() + "\\src\\test\\resource\\MavenTestProjectWithoutNUnitCopy");
-
-            withNUnitSource = new DirectoryInfo(FileUtil.GetBaseDirectory() + "\\src\\test\\resource\\MavenTestProjectWithNUnit");
-            withNUnitTarget = new DirectoryInfo(FileUtil.GetBaseDirectory() + "\\src\\test\\resource\\MavenTestProjectWithNUnitCopy");
-        }
-
-        [TestFixtureSetUp]
-        public void TestSetUp()
-        {
-            //TODO Remove when TestTearDown is fixed
-            //Delete manually
-            if (withNUnitTarget.Exists)
-            {
-                withNUnitTarget.Delete(true);
-            }
-
-            FileUtil.CopyDirectory(withoutNUnitSource, withoutNUnitTarget);
-            FileUtil.CopyDirectory(withNUnitSource, withNUnitTarget); 
-        }
-
-        [TestFixtureTearDown]
-        public void TestTearDown()
-        {
-            Directory.Delete(withoutNUnitTarget.FullName, true);
-
-            //TODO
-            //Doesn't work because some process is holding the .references folder
-            //Directory.Delete(withNUnitTarget.FullName, true);
-        }
 
         [Test]
         public void TestProjectImporterWithNunitAndUncheckedTestProject()
-        { 
-            slnFile = withNUnitTarget.FullName + "\\MavenTestProjectWithNUnit.sln";
+        {
+            Assert.IsNotNull(ProjectImporterTestFixture.SampleProjectsPath, "ProjectImporterTestFixture.SampleProjectsPath must not be null");
+            string slnFile = Path.Combine(ProjectImporterTestFixture.SampleProjectsPath, @"MavenTestProjectWithNUnit\MavenTestProjectWithNUnit.sln");
             string[] generatedPoms = NPandayImporter.ImportProject(slnFile, "test", "test-plugin", "1.0", "", UncheckedProject, ref warnMsg);
 
             Assert.IsNotNull(generatedPoms);
@@ -85,7 +48,8 @@ namespace NPanday.ProjectImporter.Import
         [Test]
         public void TestProjectImporterWithNunitAndCheckedTestProject()
         {
-            slnFile = withNUnitTarget.FullName + "\\MavenTestProjectWithNUnit.sln"; 
+            Assert.IsNotNull(ProjectImporterTestFixture.SampleProjectsPath, "ProjectImporterTestFixture.SampleProjectsPath must not be null");
+            string slnFile = Path.Combine(ProjectImporterTestFixture.SampleProjectsPath, @"MavenTestProjectWithNUnit\MavenTestProjectWithNUnit.sln");
             string[] generatedPoms = NPandayImporter.ImportProject(slnFile, "test", "test-plugin", "1.0", "", CheckedProject, ref warnMsg);
 
             Assert.IsNotNull(generatedPoms);
@@ -96,7 +60,8 @@ namespace NPanday.ProjectImporter.Import
         [Test]
         public void TestProjectImporterWithOutNunitAndCheckedTestProject()
         {
-            slnFile = withoutNUnitTarget.FullName + "\\MavenTestProjectWithoutNUnit.sln";
+            Assert.IsNotNull(ProjectImporterTestFixture.SampleProjectsPath, "ProjectImporterTestFixture.SampleProjectsPath must not be null");
+            string slnFile = Path.Combine(ProjectImporterTestFixture.SampleProjectsPath, @"MavenTestProjectWithoutNUnit\MavenTestProjectWithoutNUnit.sln");
             string[] generatedPoms = NPandayImporter.ImportProject(slnFile, "test", "test-plugin", "1.0", "", CheckedProject, ref warnMsg);
 
             Assert.IsNotNull(generatedPoms);
@@ -107,7 +72,8 @@ namespace NPanday.ProjectImporter.Import
         [Test]
         public void TestProjectImporterWithOutNunitAndUncheckedTestProject()
         {
-            slnFile = withoutNUnitTarget.FullName + "\\MavenTestProjectWithoutNUnit.sln";
+            Assert.IsNotNull(ProjectImporterTestFixture.SampleProjectsPath, "ProjectImporterTestFixture.SampleProjectsPath must not be null");
+            string slnFile = Path.Combine(ProjectImporterTestFixture.SampleProjectsPath, @"MavenTestProjectWithoutNUnit\MavenTestProjectWithoutNUnit.sln");
             string[] generatedPoms = NPandayImporter.ImportProject(slnFile, "test", "test-plugin", "1.0", "", UncheckedProject, ref warnMsg);
 
             Assert.IsNotNull(generatedPoms);