Beispiel #1
0
        public void Throws_ArgumentNull_When_CsProj_IsNull()
        {
            var fileSystem    = new MockFileSystem();
            var projectSystem = new MockBuildProjectSystem(fileSystem);
            var command       = new RestoreCommand(fileSystem, projectSystem);

            Assert.Throws <ArgumentNullException>(() => command.Run(null));
        }
Beispiel #2
0
        public void Returns_ProjectNotFound_ExitCode_When_CsProj_Not_Found()
        {
            var fileSystem    = new MockFileSystem();
            var projectSystem = new MockBuildProjectSystem(fileSystem);
            var command       = new RestoreCommand(fileSystem, projectSystem);
            var exitCode      = command.Run("nonexisting.csproj");

            Assert.Equal(ExitCodes.ProjectNotFound, exitCode);
        }
 public void TableRestoreTest()
 {
     var restoreCommand = new RestoreCommand();
     var options = new TableCommandOptions
     {
         Mode = "restore",
         Source = DataLocation,
         Destination = DevelopmentStorage
     };
     restoreCommand.Run(options);
 }
Beispiel #4
0
        public void Returns_Cant_Determine_Packages_Dir_When_Nuget_Packages_Dir_Not_Found()
        {
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>()
            {
                ["Test.csproj"] = "A"
            });

            var projectSystem = new MockBuildProjectSystem(fileSystem);
            var command       = new RestoreCommand(fileSystem, projectSystem);
            var exitCode      = command.Run("Test.csproj");

            Assert.Equal(ExitCodes.CantDeterminePackagesDir, exitCode);
        }
Beispiel #5
0
        public override int Execute()
        {
            if (ShouldRunImplicitRestore)
            {
                int exitCode = RestoreCommand.Run(ArgsToForwardToRestore().ToArray());
                if (exitCode != 0)
                {
                    return(exitCode);
                }
            }

            return(base.Execute());
        }
Beispiel #6
0
 private static bool RestoreProject(string pathToRestore)
 {
     return(RestoreCommand.Run(new string[] { pathToRestore }) == 0);
 }