private UnconfiguredProject GetMockProject(string projectFullPath = "D:\\Test\\Projects\\UCProject\\UCProject.csproj") => UnconfiguredProjectFactory.Create(filePath: projectFullPath);
public void DefaultProjectPath() { var provider = new TestProjectFileOrAssemblyInfoPropertiesProvider(UnconfiguredProjectFactory.Create(filePath: "D:\\TestFile")); Assert.Equal("D:\\TestFile", provider.DefaultProjectPath); }
internal TestBuildManager(TestTempPEBuildManager mgr) : base(IProjectThreadingServiceFactory.Create(), IUnconfiguredProjectCommonServicesFactory.Create(UnconfiguredProjectFactory.Create())) { _mgr = mgr; }
private static ActiveWorkspaceProjectContextTracker CreateInstance() { return(new ActiveWorkspaceProjectContextTracker(UnconfiguredProjectFactory.Create())); }
private static VisualBasicProjectGuidProvider CreateInstance() { var unconfiguedProject = UnconfiguredProjectFactory.Create(); return(new VisualBasicProjectGuidProvider(unconfiguedProject)); }
public void FrameOpenCloseListener_NullThreadingService_Throws() { Assert.Throws <ArgumentNullException>("threadingService", () => new FrameOpenCloseListener(IServiceProviderFactory.Create(), IProjectFileEditorPresenterFactory.Create(), null, UnconfiguredProjectFactory.Create())); }
internal TestBuildManager() : base(IProjectThreadingServiceFactory.Create(), IUnconfiguredProjectCommonServicesFactory.Create(UnconfiguredProjectFactory.Create())) { }
public void Constructor_NullAsGeneratePackageOnBuildPropertyProvider_ThrowsArgumentNull() { Assert.Throws <ArgumentNullException>(() => CreateInstanceCore(UnconfiguredProjectFactory.Create(), IProjectThreadingServiceFactory.Create(), SVsServiceProviderFactory.Create(null), null)); }
private static AvoidPersistingProjectGuidStorageProvider CreateInstance(ProjectRootElement projectXml) { var projectAccessor = IProjectAccessorFactory.Create(projectXml); return(new AvoidPersistingProjectGuidStorageProvider(projectAccessor, UnconfiguredProjectFactory.Create())); }
private ConsoleDebugTargetsProvider GetDebugTargetsProvider(string outputType = "exe", Dictionary <string, string> properties = null) { _mockFS.WriteAllText(@"c:\test\Project\someapp.exe", ""); _mockFS.CreateDirectory(@"c:\test\Project"); _mockFS.CreateDirectory(@"c:\test\Project\bin\"); _mockFS.WriteAllText(@"c:\program files\dotnet\dotnet.exe", ""); var activeProfile = new LaunchProfile() { Name = "MyApplication", CommandLineArgs = "--someArgs", ExecutablePath = @"c:\test\Project\someapp.exe" }; _mockEnvironment.Setup(s => s.GetEnvironmentVariable("Path")).Returns(() => _Path); var project = UnconfiguredProjectFactory.Create(null, null, _ProjectFile); var outputTypeEnum = new PageEnumValue(new EnumValue() { Name = outputType }); var data = new PropertyPageData() { Category = ConfigurationGeneral.SchemaName, PropertyName = ConfigurationGeneral.OutputTypeProperty, Value = outputTypeEnum }; var projectProperties = ProjectPropertiesFactory.Create(project, data); if (properties == null) { properties = new Dictionary <string, string>() { { "RunCommand", @"dotnet" }, { "RunArguments", "exec " + "\"" + @"c:\test\project\bin\project.dll" + "\"" }, { "RunWorkingDirectory", @"bin\" }, { "TargetFrameworkIdentifier", @".NetCoreApp" } }; } var delegatePropertiesMock = IProjectPropertiesFactory .MockWithPropertiesAndValues(properties); var delegateProvider = IProjectPropertiesProviderFactory.Create(null, delegatePropertiesMock.Object); IConfiguredProjectServices configuredProjectServices = Mock.Of <IConfiguredProjectServices>(o => o.ProjectPropertiesProvider == delegateProvider); ConfiguredProject configuredProject = Mock.Of <ConfiguredProject>(o => o.UnconfiguredProject == project && o.Services == configuredProjectServices); _mockTokenReplace.Setup(s => s.ReplaceTokensInProfileAsync(It.IsAny <ILaunchProfile>())).Returns <ILaunchProfile>(p => Task.FromResult(p)); IActiveDebugFrameworkServices activeDebugFramework = Mock.Of <IActiveDebugFrameworkServices>(o => o.GetConfiguredProjectForActiveFrameworkAsync() == Task.FromResult(configuredProject)); var debugProvider = new ConsoleDebugTargetsProvider( configuredProject, _mockTokenReplace.Object, _mockFS, _mockEnvironment.Object, activeDebugFramework, projectProperties); return(debugProvider); }
public void ProjectFileModelWatcher_NullEditorState_Throws() { Assert.Throws <ArgumentNullException>("editorState", () => new ProjectFileModelWatcher(null, UnconfiguredProjectFactory.Create())); }
public void EditProjectFileCommand_NullAsPresenter_Throws() { var unconfiguredProject = UnconfiguredProjectFactory.Create(); Assert.Throws <ArgumentNullException>("editorPresenter", () => new EditProjectFileCommand(unconfiguredProject, null)); }
public void Constructor() { Assert.Throws <ArgumentNullException>(() => new SourceItemHandler(UnconfiguredProjectFactory.Create(), null)); Assert.Throws <ArgumentNullException>(() => new SourceItemHandler(null, IPhysicalProjectTreeFactory.Create())); new SourceItemHandler(UnconfiguredProjectFactory.Create(), IPhysicalProjectTreeFactory.Create()); }
private static ProjectProperties CreateProperties(string appDesignerFolderName) { return(ProjectPropertiesFactory.Create(UnconfiguredProjectFactory.Create(), new[] { new PropertyPageData(AppDesigner.SchemaName, AppDesigner.FolderNameProperty, appDesignerFolderName) })); }
public async Task WhenOneTargetSnapshotAndDependencySupportsRule_ShouldCreateRule() { var dependencyRootYyy = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Yyy"", ""Id"": ""YyyDependencyRoot"", ""Name"":""YyyDependencyRoot"", ""Caption"":""YyyDependencyRoot"", ""Resolved"":""true"" }"); var dependencyYyyExisting = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Yyy"", ""Id"": ""tfm1\\yyy\\dependencyExisting"", ""Name"":""dependencyExisting"", ""Caption"":""DependencyExisting"", ""SchemaItemType"":""Yyy"", ""Resolved"":""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall, flags: DependencyTreeFlags.SupportsRuleProperties); var dependencies = new List <IDependency> { dependencyYyyExisting }; var dependencyYyyExistingTree = new TestProjectTree { Caption = "DependencyExisting", FilePath = "tfm1\\yyy\\dependencyExisting", Flags = DependencyTreeFlags.ResolvedFlags }; var dependencyRootYyyTree = new TestProjectTree { Caption = "YyyDependencyRoot", FilePath = "YyyDependencyRoot" }; dependencyRootYyyTree.Add(dependencyYyyExistingTree); var dependenciesRoot = new TestProjectTree { Caption = "MyDependencies", FilePath = "" }; dependenciesRoot.Add(dependencyRootYyyTree); var treeViewModelFactory = IMockDependenciesViewModelFactory.Implement( getDependenciesRootIcon: KnownMonikers.AboutBox, createRootViewModel: new[] { dependencyRootYyy }); var testData = new Dictionary <ITargetFramework, List <IDependency> > { { ITargetFrameworkFactory.Implement(moniker: "tfm1"), dependencies } }; var project = UnconfiguredProjectFactory.Create(filePath: @"c:\somefodler\someproject.csproj"); var commonServices = IUnconfiguredProjectCommonServicesFactory.Create(project: project); var provider = new GroupedByTargetTreeViewProvider( new MockIDependenciesTreeServices(), treeViewModelFactory, commonServices); // Act var resultTree = await provider.BuildTreeAsync(dependenciesRoot, GetSnapshot(testData)); // Assert var expectedFlatHierarchy = @"Caption=MyDependencies, FilePath=, IconHash=325248080, ExpandedIconHash=325248080, Rule=, IsProjectItem=False, CustomTag= Caption=YyyDependencyRoot, FilePath=YyyDependencyRoot, IconHash=0, ExpandedIconHash=0, Rule=, IsProjectItem=False, CustomTag= Caption=DependencyExisting, FilePath=tfm1\yyy\dependencyExisting, IconHash=325249260, ExpandedIconHash=325249260, Rule=Yyy, IsProjectItem=False, CustomTag= "; Assert.Equal(expectedFlatHierarchy, ((TestProjectTree)resultTree).FlatHierarchy); }
public void Constructor_NullAsProjectThreadingServiceFactory_ThrowsArgumentNull() { Assert.Throws<ArgumentNullException>(() => CreateInstanceCore(UnconfiguredProjectFactory.Create(), null, IVsServiceFactory.Create<SVsSolutionBuildManager, IVsSolutionBuildManager2>(null), CreateGeneratePackageOnBuildPropertyProvider())); }
public async Task WheEmptySnapshotAndVisibilityMarkerNotProvided_ShouldHideSubTreeRoot() { var dependencyRootYyy = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Yyy"", ""Id"": ""YyyDependencyRoot"", ""Name"":""YyyDependencyRoot"", ""Caption"":""YyyDependencyRoot"", ""Resolved"":""true"" }"); var dependencyVisibilityMarker = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Yyy"", ""Id"": ""someid"", ""Name"":""someid"", ""Caption"":""someid"", ""Resolved"":""false"", ""Visible"":""false"" }"); var dependencies = new List <IDependency> { dependencyVisibilityMarker }; var dependencyRootYyyTree = new TestProjectTree { Caption = "YyyDependencyRoot", FilePath = "YyyDependencyRoot" }; var dependenciesRoot = new TestProjectTree { Caption = "MyDependencies", FilePath = "" }; dependenciesRoot.Add(dependencyRootYyyTree); var treeViewModelFactory = IMockDependenciesViewModelFactory.Implement( getDependenciesRootIcon: KnownMonikers.AboutBox, createRootViewModel: new[] { dependencyRootYyy }); var testData = new Dictionary <ITargetFramework, List <IDependency> > { { ITargetFrameworkFactory.Implement(moniker: "tfm1"), dependencies } }; var project = UnconfiguredProjectFactory.Create(filePath: @"c:\somefodler\someproject.csproj"); var commonServices = IUnconfiguredProjectCommonServicesFactory.Create(project: project); var provider = new GroupedByTargetTreeViewProvider( new MockIDependenciesTreeServices(), treeViewModelFactory, commonServices); // Act var resultTree = await provider.BuildTreeAsync(dependenciesRoot, GetSnapshot(testData)); // Assert var expectedFlatHierarchy = @"Caption=MyDependencies, FilePath=, IconHash=325248080, ExpandedIconHash=325248080, Rule=, IsProjectItem=False, CustomTag= "; Assert.Equal(expectedFlatHierarchy, ((TestProjectTree)resultTree).FlatHierarchy); }
private static ImplicitlyActiveDimensionProvider CreateInstance() { var project = UnconfiguredProjectFactory.Create(); return(new ImplicitlyActiveDimensionProvider(project)); }
public async Task WhenMultipleTargetSnapshotsWithExistingDependencies_ShouldApplyChanges() { var tfm1 = ITargetFrameworkFactory.Implement(moniker: "tfm1"); var tfm2 = ITargetFrameworkFactory.Implement(moniker: "tfm2"); var tfmAny = ITargetFrameworkFactory.Implement(moniker: "any"); var dependencyRootXxx = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""XxxDependencyRoot"", ""Name"":""XxxDependencyRoot"", ""Caption"":""XxxDependencyRoot"", ""Resolved"":""true"" }"); var dependencyXxx1 = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""xxx\\dependency1"", ""Path"": ""dependencyxxxpath"", ""Name"":""dependency1"", ""Caption"":""Dependency1"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall, targetFramework: tfm1); var dependencyRootYyy = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Yyy"", ""Id"": ""YyyDependencyRoot"", ""Name"":""YyyDependencyRoot"", ""Caption"":""YyyDependencyRoot"" }"); var dependencyYyy1 = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Yyy"", ""Id"": ""yyy\\dependency1"", ""Path"": ""dependencyyyypath"", ""Name"":""dependency1"", ""Caption"":""Dependency1"", ""SchemaItemType"":""Yyy"", ""Resolved"":""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall, targetFramework: tfm1); var dependencyYyyExisting = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Yyy"", ""Id"": ""yyy\\dependencyExisting"", ""Path"": ""dependencyyyyExistingpath"", ""Name"":""dependencyExisting"", ""Caption"":""DependencyExisting"", ""SchemaItemType"":""Yyy"", ""Resolved"":""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall, targetFramework: tfm1); var dependencyRootZzz = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Zzz"", ""Id"": ""ZzzDependencyRoot"", ""Name"":""ZzzDependencyRoot"", ""Caption"":""ZzzDependencyRoot"", ""Resolved"":""true"" }", flags: ProjectTreeFlags.Create(ProjectTreeFlags.Common.BubbleUp)); var dependencyAny1 = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Zzz"", ""Id"": ""ZzzDependencyAny1"", ""Path"": ""ZzzDependencyAny1path"", ""Name"":""ZzzDependencyAny1"", ""Caption"":""ZzzDependencyAny1"" }", targetFramework: tfmAny); var dependencies = new List <IDependency> { dependencyXxx1, dependencyYyy1, dependencyYyyExisting }; var dependenciesAny = new List <IDependency> { dependencyAny1 }; var oldRootChildToBeRemoved = new TestProjectTree { Caption = "OldRootChildToBeRemoved", FilePath = "" }; var dependencyYyyExistingTree = new TestProjectTree { Caption = "DependencyExisting", FilePath = "yyy\\dependencyExisting" }; var dependencyRootYyyTree = new TestProjectTree { Caption = "YyyDependencyRoot", FilePath = "YyyDependencyRoot" }; dependencyRootYyyTree.Add(dependencyYyyExistingTree); var dependenciesRoot = new TestProjectTree { Caption = "MyDependencies", FilePath = "" }; dependenciesRoot.Add(oldRootChildToBeRemoved); dependenciesRoot.Add(dependencyRootYyyTree); var target1 = IDependencyFactory.FromJson(@" { ""Id"": ""tfm1"", ""Name"":""tfm1"", ""Caption"":""tfm1"" }"); var target2 = IDependencyFactory.FromJson(@" { ""Id"": ""tfm2"", ""Name"":""tfm2"", ""Caption"":""tfm2"" }"); var targetAny = IDependencyFactory.FromJson(@" { ""Id"": ""any"", ""Name"":""any"", ""Caption"":""any"" }"); var treeViewModelFactory = IMockDependenciesViewModelFactory.Implement( getDependenciesRootIcon: KnownMonikers.AboutBox, createRootViewModel: new[] { dependencyRootXxx, dependencyRootYyy, dependencyRootZzz }, createTargetViewModel: new[] { target1, target2 }); var testData = new Dictionary <ITargetFramework, List <IDependency> > { { tfm1, dependencies }, { tfm2, dependencies }, { tfmAny, dependenciesAny } }; var project = UnconfiguredProjectFactory.Create(filePath: @"c:\somefodler\someproject.csproj"); var commonServices = IUnconfiguredProjectCommonServicesFactory.Create(project: project); var provider = new GroupedByTargetTreeViewProvider( new MockIDependenciesTreeServices(), treeViewModelFactory, commonServices); // Act var resultTree = await provider.BuildTreeAsync(dependenciesRoot, GetSnapshot(testData)); // Assert var expectedFlatHierarchy = @"Caption=MyDependencies, FilePath=, IconHash=325248080, ExpandedIconHash=325248080, Rule=, IsProjectItem=False, CustomTag= Caption=ZzzDependencyRoot, FilePath=ZzzDependencyRoot, IconHash=0, ExpandedIconHash=0, Rule=, IsProjectItem=False, CustomTag= Caption=ZzzDependencyAny1, FilePath=ZzzDependencyAny1, IconHash=0, ExpandedIconHash=0, Rule=, IsProjectItem=False, CustomTag= Caption=tfm2, FilePath=tfm2, IconHash=0, ExpandedIconHash=0, Rule=, IsProjectItem=False, CustomTag=, BubbleUpFlag=True Caption=YyyDependencyRoot, FilePath=YyyDependencyRoot, IconHash=0, ExpandedIconHash=0, Rule=, IsProjectItem=False, CustomTag= Caption=DependencyExisting, FilePath=tfm1\Yyy\dependencyyyyExistingpath, IconHash=325249260, ExpandedIconHash=325249260, Rule=, IsProjectItem=False, CustomTag= Caption=Dependency1, FilePath=tfm1\Yyy\dependencyyyypath, IconHash=325249260, ExpandedIconHash=325249260, Rule=, IsProjectItem=False, CustomTag= Caption=XxxDependencyRoot, FilePath=XxxDependencyRoot, IconHash=0, ExpandedIconHash=0, Rule=, IsProjectItem=False, CustomTag= Caption=Dependency1, FilePath=tfm1\Xxx\dependencyxxxpath, IconHash=325249260, ExpandedIconHash=325249260, Rule=, IsProjectItem=False, CustomTag= Caption=tfm1, FilePath=tfm1, IconHash=0, ExpandedIconHash=0, Rule=, IsProjectItem=False, CustomTag=, BubbleUpFlag=True Caption=YyyDependencyRoot, FilePath=YyyDependencyRoot, IconHash=0, ExpandedIconHash=0, Rule=, IsProjectItem=False, CustomTag= Caption=DependencyExisting, FilePath=tfm1\Yyy\dependencyyyyExistingpath, IconHash=325249260, ExpandedIconHash=325249260, Rule=, IsProjectItem=True, CustomTag= Caption=Dependency1, FilePath=tfm1\Yyy\dependencyyyypath, IconHash=325249260, ExpandedIconHash=325249260, Rule=, IsProjectItem=True, CustomTag= Caption=XxxDependencyRoot, FilePath=XxxDependencyRoot, IconHash=0, ExpandedIconHash=0, Rule=, IsProjectItem=False, CustomTag= Caption=Dependency1, FilePath=tfm1\Xxx\dependencyxxxpath, IconHash=325249260, ExpandedIconHash=325249260, Rule=, IsProjectItem=True, CustomTag= "; Assert.Equal(expectedFlatHierarchy, ((TestProjectTree)resultTree).FlatHierarchy); }
public void FrameOpenCloseListener_NullEditorModel_Throws() { Assert.Throws <ArgumentNullException>("editorModel", () => new FrameOpenCloseListener(IServiceProviderFactory.Create(), null, IProjectThreadingServiceFactory.Create(), UnconfiguredProjectFactory.Create())); }
public void WhenFindByPathAndNeedToFindDependenciesRoot_ShouldNotFind() { // Arrange const string projectPath = @"c:\myfolder\mysubfolder\myproject.csproj"; var projectFolder = Path.GetDirectoryName(projectPath); var treeServices = new MockIDependenciesTreeServices(); var treeViewModelFactory = IMockDependenciesViewModelFactory.Implement(); var project = UnconfiguredProjectFactory.Create(filePath: projectPath); var commonServices = IUnconfiguredProjectCommonServicesFactory.Create(project: project); var projectRoot = new TestProjectTree { Caption = "myproject", FilePath = "", Flags = ProjectTreeFlags.Empty }; var dependenciesRoot = new TestProjectTree { Caption = "MyDependencies", FilePath = "", Flags = DependencyTreeFlags.DependenciesRootNodeFlags }; var level1Child1 = new TestProjectTree { Caption = "level1Child1", FilePath = @"c:\folder\level1Child1", Flags = ProjectTreeFlags.Empty }; var level1Child2 = new TestProjectTree { Caption = "level1Child2", FilePath = @"c:\folder\level1Child2", Flags = ProjectTreeFlags.Empty }; var level2Child21 = new TestProjectTree { Caption = "level2Child21", FilePath = @"c:\folder\level2Child21", Flags = ProjectTreeFlags.Empty }; var level2Child22 = new TestProjectTree { Caption = "level1Child22", FilePath = @"c:\folder\level2Child22", Flags = ProjectTreeFlags.Empty }; var level3Child31 = new TestProjectTree { Caption = "level3Child31", FilePath = @"c:\folder\level3Child31", Flags = ProjectTreeFlags.Empty }; var level3Child32 = new TestProjectTree { Caption = "level3Child32", FilePath = @"level3Child32", Flags = ProjectTreeFlags.Empty }; projectRoot.Add(dependenciesRoot); dependenciesRoot.Add(level1Child1); dependenciesRoot.Add(level1Child2); level1Child2.Add(level2Child21); level1Child2.Add(level2Child22); level2Child22.Add(level3Child31); level2Child22.Add(level3Child32); // Act var provider = new GroupedByTargetTreeViewProvider(treeServices, treeViewModelFactory, commonServices); var result = provider.FindByPath(projectRoot, Path.Combine(projectFolder, @"level3Child32")); // Assert Assert.Null(result); }
public async Task FrameOpenCloseListener_NullFrame_Throws() { await Assert.ThrowsAsync <ArgumentNullException>("frame", async() => { var listener = new FrameOpenCloseListener(IServiceProviderFactory.Create(), IProjectFileEditorPresenterFactory.Create(), IProjectThreadingServiceFactory.Create(), UnconfiguredProjectFactory.Create()); await listener.InitializeEventsAsync(null); }); }
private static ProjectImageProviderAggregator CreateInstance(UnconfiguredProject?project = null) { project ??= UnconfiguredProjectFactory.Create(); return(new ProjectImageProviderAggregator(project)); }