void AddTwoProjects() { var project = new FakeSelectedProject("Test1"); fakeSelectedProjects.Add(project); project = new FakeSelectedProject("Test2"); fakeSelectedProjects.Add(project); }
public void GetProjects_SolutionHasTwoProjectsAndOneProjectSelectedInProjectsBrowserAndPackageIsInstalledInProject_ReturnsProjectAndIsSelectedIsTrue() { CreateFakeSolution(); List<IProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService(); projectsAddedToSolution[0].Name = "Aaa"; IProject msbuildProject = projectsAddedToSolution[1]; msbuildProject.Name = "MyProject"; fakeSolution.FakeActiveMSBuildProject = msbuildProject; var fakePackage = new FakePackage(); var fakeProject = fakeSolution.AddFakeProjectToReturnFromGetProject("MyProject"); fakeProject.FakePackages.Add(fakePackage); fakeSolution.AddFakeProjectToReturnFromGetProject("Aaa"); CreateSelectedProjects(); List<IPackageManagementSelectedProject> projects = selectedProjects.GetProjects(fakePackage).ToList(); var expectedProject = new FakeSelectedProject("MyProject", selected: true); var expectedProjects = new List<IPackageManagementSelectedProject>(); expectedProjects.Add(expectedProject); SelectedProjectCollectionAssert.AreEqual(expectedProjects, projects); Assert.AreEqual(fakePackage.FakePackageRepository, fakeSolution.RepositoryPassedToGetProject); Assert.AreEqual(msbuildProject, fakeSolution.ProjectPassedToGetProject); }
void AddProject(string name, bool selected) { var project = new FakeSelectedProject() { Name = name, IsSelected = selected }; Projects.Add(project); }
public void GetProjects_SolutionHasTwoProjectsAndOneProjectSelectedInProjectsBrowser_ReturnsProjectSelectedInProjects() { CreateFakeSolution(); List<IProject> projectsAddedToSolution = AddSolutionWithTwoProjectsToProjectService(); IProject project = projectsAddedToSolution[1]; project.Name = "MyProject"; fakeSolution.FakeActiveMSBuildProject = project; var fakeProject = fakeSolution.AddFakeProjectToReturnFromGetProject("MyProject"); CreateSelectedProjects(); var fakePackage = new FakePackage(); var projects = new List<IPackageManagementSelectedProject>(); projects.AddRange(selectedProjects.GetProjects(fakePackage)); var expectedProject = new FakeSelectedProject("MyProject", selected: false, enabled: true); var expectedProjects = new List<IPackageManagementSelectedProject>(); expectedProjects.Add(expectedProject); SelectedProjectCollectionAssert.AreEqual(expectedProjects, projects); }
FakePackageOperation AddFakeUninstallPackageOperationWithPackageThatRequiresLicenseAcceptance(FakeSelectedProject selectedProject) { FakePackageOperation uninstallOperation = selectedProject.AddFakeUninstallPackageOperation(); uninstallOperation.FakePackage.RequireLicenseAcceptance = true; return uninstallOperation; }
FakePackageOperation AddFakeInstallPackageOperationWithPackage(FakeSelectedProject selectedProject, bool requireLicenseAcceptance) { FakePackageOperation operation = selectedProject.AddFakeInstallPackageOperation(); operation.FakePackage.RequireLicenseAcceptance = requireLicenseAcceptance; return operation; }
FakePackageOperation AddFakeInstallPackageOperationWithPackageThatDoesNotRequireLicenseAcceptance(FakeSelectedProject selectedProject) { return AddFakeInstallPackageOperationWithPackage(selectedProject, requireLicenseAcceptance: false); }