예제 #1
0
        public void RestoreCommandNoFilesToUse()
        {
            // Arrange
            var fileSystem = new MockFileSystem();

            var restoreCommand = new RestoreCommand()
            {
                FileSystem = fileSystem
            };

            // Assert
            ExceptionAssert.Throws<InvalidOperationException>(
                () => restoreCommand.DetermineRestoreMode(),
                "This folder contains no solution files, nor packages.config files.");
        }
예제 #2
0
        public void RestoreCommandMultipleSolutionFiles()
        {
            // Arrange
            var fileSystem = new MockFileSystem();
            fileSystem.AddFile("a.sln");
            fileSystem.AddFile("b.sln");

            var restoreCommand = new RestoreCommand()
            {
                FileSystem = fileSystem
            };

            // Assert
            ExceptionAssert.Throws<InvalidOperationException>(
                () => restoreCommand.DetermineRestoreMode(),
                "This folder contains more than one solution file.");
        }
예제 #3
0
        public void RestoreCommandPreferSolutionFile()
        {
            // Arrange
            var fileSystem = new MockFileSystem();
            fileSystem.AddFile("a.sln");
            fileSystem.AddFile("packages.config");

            var restoreCommand = new RestoreCommand()
            {
                FileSystem = fileSystem
            };

            // Act
            restoreCommand.DetermineRestoreMode();

            // Assert
            Assert.True(restoreCommand.RestoringForSolution);
            Assert.Equal(fileSystem.GetFullPath("a.sln"), restoreCommand.SolutionFileFullPath);
        }