1 using System; 2 using NUnit.Framework; 3 using Premake.Tests.Framework; 4 5 namespace Premake.Tests.SharpDev 6 { 7 [TestFixture] 8 public class Test_Paths 9 { 10 Script _script; 11 Project _expects; 12 Parser _parser; 13 14 #region Setup and Teardown 15 [SetUp] Test_Setup()16 public void Test_Setup() 17 { 18 _script = Script.MakeBasic("exe", "c#"); 19 20 _expects = new Project(); 21 _expects.Package.Add(1); 22 23 _parser = new SharpDevParser(); 24 } 25 Run()26 public void Run() 27 { 28 TestEnvironment.Run(_script, _parser, _expects, null); 29 } 30 #endregion 31 32 [Test] Test_AllInSameDirectory()33 public void Test_AllInSameDirectory() 34 { 35 _expects.Package[0].Path = "."; 36 Run(); 37 } 38 39 [Test] Test_PackageInSubDir()40 public void Test_PackageInSubDir() 41 { 42 _script.Append("package.path = 'MySubDir'"); 43 _expects.Package[0].Path = "./MySubDir"; 44 Run(); 45 } 46 47 [Test] Test_ProjectInSubDir()48 public void Test_ProjectInSubDir() 49 { 50 _script.Append("project.path = 'Build'"); 51 _expects.Path = "Build"; 52 _expects.Package[0].Path = ".."; 53 Run(); 54 } 55 56 [Test] Test_BothInSubDirs()57 public void Test_BothInSubDirs() 58 { 59 _script.Append("project.path = 'BuildDir'"); 60 _script.Append("package.path = 'PkgDir'"); 61 _expects.Path = "BuildDir"; 62 _expects.Package[0].Path = "../PkgDir"; 63 Run(); 64 } 65 66 [Test] Test_BothInSameSubDir()67 public void Test_BothInSameSubDir() 68 { 69 _script.Append("project.path = 'Build'"); 70 _script.Append("package.path = 'Build'"); 71 _expects.Path = "Build"; 72 _expects.Package[0].Path = "."; 73 Run(); 74 } 75 76 } 77 } 78