public void NewPackageCmdletThrowsIfNoSolutionIsClosed() { // Arrange var packageManagerFactory = new Mock<IVsPackageManagerFactory>(); packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns((IVsPackageManager)null); var cmdlet = new NewPackageCommand(TestUtils.GetSolutionManager(isSolutionOpen: false, defaultProjectName: null), packageManagerFactory.Object, null); // Act and Assert ExceptionAssert.Throws<InvalidOperationException>(() => cmdlet.GetResults(), "The current environment doesn't have a solution open."); }
public void NewPackageCmdletThrowsIfNoSolutionIsClosed() { // Arrange var packageManagerFactory = new Mock <IVsPackageManagerFactory>(); packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns((IVsPackageManager)null); var cmdlet = new NewPackageCommand(TestUtils.GetSolutionManager(isSolutionOpen: false, defaultProjectName: null), packageManagerFactory.Object, null); // Act and Assert ExceptionAssert.Throws <InvalidOperationException>(() => cmdlet.GetResults(), "The current environment doesn't have a solution open."); }
public void NewPackageCmdletThrowsIfProjectSpecifiedDoesNotExist() { // Arrange var project = "does-not-exist"; var packageManagerFactory = new Mock<IVsPackageManagerFactory>(); packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns((IVsPackageManager)null); var solutionManager = TestUtils.GetSolutionManager(defaultProjectName: "test", projects: new[] { TestUtils.GetProject("test") }); var cmdlet = new NewPackageCommand(solutionManager, packageManagerFactory.Object, null); cmdlet.ProjectName = project; // Act and Assert ExceptionAssert.Throws<ItemNotFoundException>(() => cmdlet.GetResults(), String.Format("Project '{0}' is not found.", project)); }
public void NewPackageCmdletThrowsIfMultipleSpecFilesExistAndSpecParameterDoesNotExist() { // Arrange var projectName = "test"; var packageManagerFactory = new Mock<IVsPackageManagerFactory>(); packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns((IVsPackageManager)null); var project = TestUtils.GetProject(projectName, projectFiles: new[] { "foo.nuspec", "bar.nuspec", "foo.dll" }); var solutionManager = TestUtils.GetSolutionManager(projects: new[] { project }); var cmdlet = new NewPackageCommand(solutionManager, packageManagerFactory.Object, null); cmdlet.ProjectName = projectName; // Act and Assert ExceptionAssert.Throws<InvalidOperationException>(() => cmdlet.GetResults(), "More than one .nuspec files were found."); }
public void NewPackageCmdletThrowsIfSpecFileDoesNotExistAndSpecParameterDoesNotExist() { // Arrange var projectName = "test"; var packageManagerFactory = new Mock<IVsPackageManagerFactory>(); packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns((IVsPackageManager)null); var project = TestUtils.GetProject(projectName, projectFiles: new[] { "test.cs", "assembly.info", "foo.dll" }); var solutionManager = TestUtils.GetSolutionManager(projects: new[] { project }); var cmdlet = new NewPackageCommand(solutionManager, packageManagerFactory.Object, null); cmdlet.ProjectName = projectName; // Act and Assert ExceptionAssert.Throws<ItemNotFoundException>(() => cmdlet.GetResults(), "Unable to locate a .nuspec file in the specified project."); }
public void NewPackageCmdletThrowsIfProjectSpecifiedDoesNotExist() { // Arrange var project = "does-not-exist"; var packageManagerFactory = new Mock <IVsPackageManagerFactory>(); packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns((IVsPackageManager)null); var solutionManager = TestUtils.GetSolutionManager(defaultProjectName: "test", projects: new[] { TestUtils.GetProject("test") }); var cmdlet = new NewPackageCommand(solutionManager, packageManagerFactory.Object, null); cmdlet.ProjectName = project; // Act and Assert ExceptionAssert.Throws <ItemNotFoundException>(() => cmdlet.GetResults(), String.Format("Project '{0}' is not found.", project)); }
public void NewPackageCmdletThrowsIfMultipleSpecFilesExistAndSpecParameterDoesNotExist() { // Arrange var projectName = "test"; var packageManagerFactory = new Mock <IVsPackageManagerFactory>(); packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns((IVsPackageManager)null); var project = TestUtils.GetProject(projectName, projectFiles: new[] { "foo.nuspec", "bar.nuspec", "foo.dll" }); var solutionManager = TestUtils.GetSolutionManager(projects: new[] { project }); var cmdlet = new NewPackageCommand(solutionManager, packageManagerFactory.Object, null); cmdlet.ProjectName = projectName; // Act and Assert ExceptionAssert.Throws <InvalidOperationException>(() => cmdlet.GetResults(), "More than one .nuspec files were found."); }
public void NewPackageCmdletThrowsIfSpecFileDoesNotExistAndSpecParameterDoesNotExist() { // Arrange var projectName = "test"; var packageManagerFactory = new Mock <IVsPackageManagerFactory>(); packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns((IVsPackageManager)null); var project = TestUtils.GetProject(projectName, projectFiles: new[] { "test.cs", "assembly.info", "foo.dll" }); var solutionManager = TestUtils.GetSolutionManager(projects: new[] { project }); var cmdlet = new NewPackageCommand(solutionManager, packageManagerFactory.Object, null); cmdlet.ProjectName = projectName; // Act and Assert ExceptionAssert.Throws <ItemNotFoundException>(() => cmdlet.GetResults(), "Unable to locate a .nuspec file in the specified project."); }