public void CanAddSaveSolutionWithNestedProjectReferences() { CopyTestDataToPath("CsTestProject1.csproj", Path.Combine(_testDataPath, "sub", "p1")); CopyTestDataToPath("CsTestProject2.csproj", Path.Combine(_testDataPath, "sub", "p2")); CopyTestDataToPath("CsTestProject3.csproj", Path.Combine(_testDataPath, "p3", "sub")); _scanningCommand = new ScanningCommand(_testDataPath, true); _scanningCommand.Start().Wait(); Project project; _scanningCommand.Projects.TryGetValue(Path.Combine(_testDataPath, "p3", "sub", "CsTestProject3.csproj"), out project); var solution = new SolutionViewModel(_settings, _testDataPath, _scanningCommand.Projects); solution.AddProject(project); // we need to change the Guid of the reference folder var refFolder = solution.SolutionItems.OfType<SolutionFolder>().First(); refFolder.Guid = new Guid("{95374152-F021-4ABB-B317-74A183A89F00}"); refFolder.Items.OfType<SolutionFolder>().First().Guid = new Guid("{CE1BA3BF-4957-4CBC-9D45-3DC68106B311}"); var targetPath = Path.Combine(_testDataPath, "test.sln"); var cmd = new SaveSolutionCommand(_settings, targetPath, VisualStudioVersion.VS2010, solution); cmd.Execute(); Assert.AreEqual(ReadFromResource("CsTestProject3.sln"), File.ReadAllText(targetPath)); }
public async void OnLoaded() { _scanningCommand.ProgressTextChanged += OnProgressTextChanged; var result = await _scanningCommand.Start(); _scanningCommand.ProgressTextChanged -= OnProgressTextChanged; Close(result); }
protected override void OnActivate() { base.OnActivate(); _scanningCommand.ProgressTextChanged += OnProgressTextChanged; _scanningCommand.Start().ContinueWith(t => { Result = t.Result; TryClose(true); }, TaskScheduler.Current); }
public void CanReadProjectInSubdirectory() { CopyTestDataToPath("CsTestProject1.csproj", Path.Combine(_testDataPath, "dir")); _scanningCommand = new ScanningCommand(_testDataPath, true); var scanResult = _scanningCommand.Start().Result; Assert.AreEqual(Path.Combine(_testDataPath, "dir", "CsTestProject1.csproj"), scanResult.ProjectFolder.Projects[0].Filepath); }
public void CanScanEmptyDirectory() { _scanningCommand = new ScanningCommand(_testDataPath, true); var scanResult = _scanningCommand.Start().Result; Assert.AreEqual(_testDataPath, scanResult.ProjectFolder.FullPath); Assert.AreEqual(_testDataFolderName, scanResult.ProjectFolder.Name); Assert.IsEmpty(scanResult.ProjectFolder.Folders); Assert.IsEmpty(scanResult.ProjectFolder.Projects); }
public void EmptySubdirectoriesAreOmitted() { Directory.CreateDirectory(Path.Combine(_testDataPath, "YouShouldNotSeeMe")); _scanningCommand = new ScanningCommand(_testDataPath, true); var scanResult = _scanningCommand.Start().Result; Assert.AreEqual(_testDataPath, scanResult.ProjectFolder.FullPath); Assert.AreEqual(_testDataFolderName, scanResult.ProjectFolder.Name); Assert.IsEmpty(scanResult.ProjectFolder.Folders); Assert.IsEmpty(scanResult.ProjectFolder.Projects); }
public void CanScanTwoProjectsInSubdirectories() { CopyTestDataToPath("CsTestProject1.csproj", Path.Combine(_testDataPath, "p1")); CopyTestDataToPath("CsTestProject2.csproj", Path.Combine(_testDataPath, "p2")); _scanningCommand = new ScanningCommand(_testDataPath, true); var scanResult = _scanningCommand.Start().Result; Assert.AreEqual(_testDataPath, scanResult.ProjectFolder.FullPath); Assert.AreEqual(_testDataFolderName, scanResult.ProjectFolder.Name); Assert.AreEqual(2, scanResult.ProjectFolder.Projects.Count); }
public void CanScanTwoProjectsInRoot() { CopyTestDataToPath("CsTestProject1.csproj", _testDataPath); CopyTestDataToPath("CsTestProject2.csproj", _testDataPath); _scanningCommand = new ScanningCommand(_testDataPath, true); var scanResult = _scanningCommand.Start().Result; Assert.AreEqual(_testDataPath, scanResult.ProjectFolder.FullPath); Assert.AreEqual(_testDataFolderName, scanResult.ProjectFolder.Name); Assert.IsEmpty(scanResult.ProjectFolder.Folders); Assert.AreEqual(2, scanResult.ProjectFolder.Projects.Count); }
public void CanAddProject() { CopyTestDataToPath("CsTestProject1.csproj", _testDataPath); _scanningCommand = new ScanningCommand(_testDataPath, true); _scanningCommand.Start().Wait(); Project project; _scanningCommand.Projects.TryGetValue(Path.Combine(_testDataPath, "CsTestProject1.csproj"), out project); var sut = new SolutionViewModel(new DummyStatusMessenger(), _settings, _testDataPath, _scanningCommand.Projects); sut.AddProject(project); Assert.AreEqual(1, sut.SolutionItems.Count); Assert.AreEqual("CsTestProject1", sut.SolutionItems[0].Name); Assert.AreEqual(typeof (SolutionProject), sut.SolutionItems[0].GetType()); }
public void CanAddSaveSolution() { CopyTestDataToPath("CsTestProject1.csproj", _testDataPath); _scanningCommand = new ScanningCommand(_testDataPath, true); _scanningCommand.Start().Wait(); Project project; _scanningCommand.Projects.TryGetValue(Path.Combine(_testDataPath, "CsTestProject1.csproj"), out project); var solution = new SolutionViewModel(_settings, _testDataPath, _scanningCommand.Projects); solution.AddProject(project); var targetPath = Path.Combine(_testDataPath, "test.sln"); var cmd = new SaveSolutionCommand(_settings, targetPath, VisualStudioVersion.VS2010, solution); cmd.Execute(); Assert.AreEqual(ReadFromResource("CsTestProject1.sln"), File.ReadAllText(targetPath)); }
public void CanAddProjectWithProjectReference() { CopyTestDataToPath("CsTestProject1.csproj", Path.Combine(_testDataPath, "p1")); CopyTestDataToPath("CsTestProject2.csproj", Path.Combine(_testDataPath, "p2")); _scanningCommand = new ScanningCommand(_testDataPath, true); _scanningCommand.Start().Wait(); Project project; _scanningCommand.Projects.TryGetValue(Path.Combine(_testDataPath, "p2", "CsTestProject2.csproj"), out project); var sut = new SolutionViewModel(new DummyStatusMessenger(), _settings, _testDataPath, _scanningCommand.Projects); sut.AddProject(project); Assert.AreEqual(2, sut.SolutionItems.Count); Assert.AreEqual("_References", sut.SolutionItems[0].Name); Assert.AreEqual("CsTestProject2", sut.SolutionItems[1].Name); Assert.AreEqual(1, ((SolutionFolder) sut.SolutionItems[0]).Items.Count); Assert.AreEqual("CsTestProject1", ((SolutionFolder) sut.SolutionItems[0]).Items[0].Name); }