Esempio n. 1
0
        public static PackageManager CreatePackageManager(string solutionPath = @"C:\Projects\Test\Solution.sln",
                                                    int targetFramework = 0, 
                                                    string projectPath = @"C:\Projects\Test\Test.csproj",
                                                    string[] references = null,
                                                    string[] commandLines = null,
                                                    string[] paths = null,
                                                    Configuration config = null
                                    )
        {
            var project = new MockProject(projectPath);
            if (references != null)
            {
                foreach (var reference in references)
                {
                    project.AddReference(reference);
                }
            }

            if (commandLines == null)
            {
                commandLines = new string[]
                                   {
                                       "log4net (1.2.10)",
                                       "nu (0.1.17)",
                                       "thor (0.14.0)"
                                   };
            }
            if (paths == null)
            {
                paths = new string[]
                            {
                                @"C:\Projects\Test\lib\log4net\LICENSE.txt",
                                @"C:\Projects\Test\lib\log4net\log4net.dll",
                                @"C:\Projects\Test\lib\log4net\log4net.xml",
                                @"C:\Projects\Test\lib\log4net\NOTICE.txt",
                                @"C:\Projects\Test\lib\log4net\README.txt"
                            };
            }

            if (config == null)
            {
                config = new Configuration
                             {
                                 GemCommand = "gem"
                             };
            }
            return new PackageManager(solutionPath, targetFramework, project, new MockCommandRunner(commandLines), new MockFileSystem(paths), new MockConfigurationManager(config));
        }
Esempio n. 2
0
        public PackageManager(string solutionPath, int targetFramework, IProject project, ICommandRunner runner, IFileSystem fs, IConfigurationManager configManager)
        {
            _solutionPath = solutionPath;

            // lib will be in solution folder
            _rootPath = Path.GetDirectoryName(_solutionPath);

            // if parent of solution is src folder, then use solution parent
            // lib should be sibling of src
            if (string.Compare(Path.GetFileName(_rootPath), "src", true) == 0)
            {
                _rootPath = Path.GetDirectoryName(_rootPath);
            }
            _libPath = Path.Combine(_rootPath, "lib");
            _targetFramework = targetFramework == 0 ? 0x00020000 : targetFramework; // default to 2.0
            _project = project;
            _runner = runner;
            _fs = fs;
            _configManager = configManager;
            _config = _configManager.GetConfig();
        }
Esempio n. 3
0
 public void VerifySearchGemCommand(string gemCommand, string gemServer, string query, string expectedResult)
 {
     var config = new Configuration { GemCommand = gemCommand, GemServer = gemServer };
     var command = config.GemSearchCommand(query);
     Assert.AreEqual(expectedResult, command);
 }
Esempio n. 4
0
 public void VerifyListGemCommand(string gemCommand, string gemServer, string expectedResult)
 {
     var config = new Configuration {GemCommand = gemCommand, GemServer = gemServer};
     var command = config.GemListCommand();
     Assert.AreEqual(expectedResult, command);
 }