internal async Task RenameAsync(string sourceCode, string oldFilePath, string newFilePath, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, IVsOnlineServices vsOnlineServices, string language) { var unconfiguredProject = UnconfiguredProjectFactory.Create(fullPath: $@"C:\project1.{ProjectFileExtension}"); var projectServices = IUnconfiguredProjectVsServicesFactory.Implement( threadingServiceCreator: () => IProjectThreadingServiceFactory.Create(), unconfiguredProjectCreator: () => unconfiguredProject); using var ws = new AdhocWorkspace(); ws.AddSolution(InitializeWorkspace(ProjectId.CreateNewId(), oldFilePath, sourceCode, language)); var environmentOptionsFactory = IEnvironmentOptionsFactory.Implement((string category, string page, string property, bool defaultValue) => { return(true); }); var waitIndicator = (new Mock <IWaitIndicator>()).Object; var projectThreadingService = IProjectThreadingServiceFactory.Create(); var refactorNotifyService = (new Mock <IRefactorNotifyService>()).Object; var extensibility = new Mock <IVsUIService <IVsExtensibility, IVsExtensibility3> >().Object; var operationProgressMock = new Mock <IVsService <SVsOperationProgress, IVsOperationProgressStatusService> >().Object; var context = new Mock <IProjectTreeActionHandlerContext>().Object; var mockNode = new Mock <IProjectTree>(); mockNode.SetupGet(x => x.FilePath).Returns(oldFilePath); mockNode.SetupGet(x => x.IsFolder).Returns(false); var node = mockNode.Object; var renamer = new TestRenamerProjectTreeActionHandler(unconfiguredProject, projectServices, ws, environmentOptionsFactory, userNotificationServices, roslynServices, waitIndicator, vsOnlineServices, projectThreadingService, extensibility, operationProgressMock); await renamer.RenameAsync(context, node, newFilePath) .TimeoutAfter(TimeSpan.FromSeconds(1)); }
internal async Task RenameAsync(string sourceCode, string oldFilePath, string newFilePath, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, string language) { using var ws = new AdhocWorkspace(); var projectId = ProjectId.CreateNewId(); Solution solution = ws.AddSolution(InitializeWorkspace(projectId, newFilePath, sourceCode, language)); Project project = (from d in solution.Projects where d.Id == projectId select d).FirstOrDefault(); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: $@"C:\project1.{ProjectFileExtension}"); var projectServices = IUnconfiguredProjectVsServicesFactory.Implement( threadingServiceCreator: () => IProjectThreadingServiceFactory.Create(), unconfiguredProjectCreator: () => unconfiguredProject); var unconfiguredProjectTasksService = IUnconfiguredProjectTasksServiceFactory.Create(); var environmentOptionsFactory = IEnvironmentOptionsFactory.Implement((string category, string page, string property, bool defaultValue) => { return(true); }); var waitIndicator = (new Mock <IWaitIndicator>()).Object; var refactorNotifyService = (new Mock <IRefactorNotifyService>()).Object; var dte = IVsUIServiceFactory.Create <Shell.Interop.SDTE, EnvDTE.DTE>(null !); var renamer = new Renamer(projectServices, unconfiguredProjectTasksService, ws, dte, environmentOptionsFactory, userNotificationServices, roslynServices, waitIndicator, refactorNotifyService); await renamer.HandleRenameAsync(oldFilePath, newFilePath) .TimeoutAfter(TimeSpan.FromSeconds(1)); }
public static TestVisualBasicNamespaceImportsList CreateInstance(params string[] list) { var newList = new TestVisualBasicNamespaceImportsList( UnconfiguredProjectFactory.Create(), IProjectThreadingServiceFactory.Create(), IActiveConfiguredProjectSubscriptionServiceFactory.Create()); newList.VSImports = new Lazy <VisualBasicVSImports>(() => new TestVisualBasicVSImports( Mock.Of <VSLangProj.VSProject>(), IProjectThreadingServiceFactory.Create(), IActiveConfiguredValueFactory.ImplementValue <ConfiguredProject>(() => ConfiguredProjectFactory.Create()), IProjectAccessorFactory.Create(), IUnconfiguredProjectVsServicesFactory.Create(), newList)); newList.TestApply(list); newList.ImportsAdded.Clear(); newList.ImportsRemoved.Clear(); return(newList); }
public async Task SetProperty_DoesNothing_WhenSpecifiedPropertyPageIsNotFound() { bool launchSettingsUpdated = false; var catalogProvider = GetCatalogProviderAndData(); var provider = new LaunchTargetPropertyPageValueProvider( project: UnconfiguredProjectFactory.Create( configuredProject: ConfiguredProjectFactory.Create( services: ConfiguredProjectServicesFactory.Create( propertyPagesCatalogProvider: catalogProvider))), launchSettingsProvider: SetupLaunchSettingsProvider( activeProfileName: "Alpha", activeProfileLaunchTarget: "AlphaCommand", updateLaunchSettingsCallback: ls => launchSettingsUpdated = true), projectThreadingService: IProjectThreadingServiceFactory.Create()); var actualValue = await provider.OnSetPropertyValueAsync("EpsilonPage", Mock.Of <IProjectProperties>()); Assert.Null(actualValue); Assert.False(launchSettingsUpdated); }
public async Task SetProperty_UpdatesActiveProfileCommand_WhenAPageWithAMatchingNameIsFound() { string newLaunchTarget = string.Empty; var catalogProvider = GetCatalogProviderAndData(); var provider = new LaunchTargetPropertyPageValueProvider( project: UnconfiguredProjectFactory.Create( configuredProject: ConfiguredProjectFactory.Create( services: ConfiguredProjectServicesFactory.Create( propertyPagesCatalogProvider: catalogProvider))), launchSettingsProvider: SetupLaunchSettingsProvider( activeProfileName: "Alpha", activeProfileLaunchTarget: "AlphaCommand", updateLaunchSettingsCallback: ls => newLaunchTarget = ls.ActiveProfile !.CommandName), projectThreadingService: IProjectThreadingServiceFactory.Create()); var actualValue = await provider.OnSetPropertyValueAsync(string.Empty, "GammaPage", Mock.Of <IProjectProperties>()); Assert.Null(actualValue); Assert.Equal(expected: "GammaCommand", actual: newLaunchTarget); }
private PackageRestoreServiceInstance CreateInstance(UnconfiguredProject?project = null, IPackageRestoreUnconfiguredInputDataSource?dataSource = null, IVsSolutionRestoreService3?solutionRestoreService = null) { project ??= UnconfiguredProjectFactory.Create(); dataSource ??= IPackageRestoreUnconfiguredInputDataSourceFactory.Create(); IProjectThreadingService threadingService = IProjectThreadingServiceFactory.Create(); IProjectAsynchronousTasksService projectAsynchronousTasksService = IProjectAsynchronousTasksServiceFactory.Create(); solutionRestoreService ??= IVsSolutionRestoreServiceFactory.Create(); IProjectLogger logger = IProjectLoggerFactory.Create(); IFileSystem fileSystem = IFileSystemFactory.Create(); var broadcastBlock = DataflowBlockSlim.CreateBroadcastBlock <IProjectVersionedValue <RestoreData> >(); return(new PackageRestoreServiceInstance( project, dataSource, threadingService, projectAsynchronousTasksService, solutionRestoreService, fileSystem, logger, broadcastBlock)); }
public async Task Dispose_ValidateUnRegisterProject() { var spMock = new IServiceProviderMoq(); spMock.AddService(typeof(IVsFileChangeEx), typeof(SVsFileChangeEx), IVsFileChangeExFactory.CreateWithAdviseUnadviseFileChange(100)); spMock.AddService(typeof(IVsSolution), typeof(SVsSolution), IVsSolutionFactory.CreateWithAdviseUnadviseSolutionEvents(150)); var rlm = new ProjectReloadManager(IProjectThreadingServiceFactory.Create(), spMock, IUserNotificationServicesFactory.ImplementReportErrorInfo(), new Mock <IDialogServices>().Object); var reloadableProjectMock = new Mock <IReloadableProject>(MockBehavior.Strict); reloadableProjectMock.Setup(x => x.ProjectFile).Returns(@"c:\temp\project1.csproj"); await rlm.RegisterProjectAsync(reloadableProjectMock.Object); Assert.Equal(1, rlm.RegisteredProjects.Count); await rlm.UnregisterProjectAsync(reloadableProjectMock.Object); Assert.Equal(0, rlm.RegisteredProjects.Count); reloadableProjectMock.VerifyAll(); }
public async Task OnAfterRenameProject_ValidateRenamedProjectIsRegisterd() { string projectFile = @"c:\temp\project1.csproj"; var spMock = new IServiceProviderMoq(); spMock.AddService(typeof(IVsFileChangeEx), typeof(SVsFileChangeEx), IVsFileChangeExFactory.CreateWithAdviseUnadviseFileChange(100)); spMock.AddService(typeof(IVsSolution), typeof(SVsSolution), IVsSolutionFactory.CreateWithAdviseUnadviseSolutionEvents(150)); var rlm = new ProjectReloadManager(IProjectThreadingServiceFactory.Create(), spMock, IUserNotificationServicesFactory.ImplementReportErrorInfo(), new Mock <IDialogServices>().Object); var reloadableProjectMock = new Mock <IReloadableProject>(MockBehavior.Strict); var hierMock = new Mock <IVsHierarchy>(); reloadableProjectMock.Setup(x => x.ProjectFile).Returns(() => projectFile); reloadableProjectMock.Setup(x => x.VsHierarchy).Returns(hierMock.Object); await rlm.RegisterProjectAsync(reloadableProjectMock.Object); rlm.OnAfterRenameProject(hierMock.Object); Assert.Same(reloadableProjectMock.Object, rlm.RegisteredProjects.First().Key); reloadableProjectMock.VerifyAll(); }
private PackageRestoreDataSource CreateInstance(UnconfiguredProject?project = null, IPackageRestoreUnconfiguredInputDataSource?dataSource = null, IVsSolutionRestoreService3?solutionRestoreService = null) { project ??= UnconfiguredProjectFactory.Create(IProjectThreadingServiceFactory.Create()); dataSource ??= IPackageRestoreUnconfiguredInputDataSourceFactory.Create(); IProjectAsynchronousTasksService projectAsynchronousTasksService = IProjectAsynchronousTasksServiceFactory.Create(); solutionRestoreService ??= IVsSolutionRestoreServiceFactory.Create(); IProjectLogger logger = IProjectLoggerFactory.Create(); IFileSystem fileSystem = IFileSystemFactory.Create(); var hintService = new Lazy <IProjectChangeHintSubmissionService>(() => IProjectChangeHintSubmissionServiceFactory.Create()); var projectAccessor = IProjectAccessorFactory.Create(); return(new PackageRestoreDataSource( project, dataSource, projectAsynchronousTasksService, solutionRestoreService, fileSystem, hintService, projectAccessor, logger)); }
private static ConsoleDebugTargetsProvider CreateInstance( ConfiguredProject?configuredProject = null, IDebugTokenReplacer?tokenReplacer = null, IFileSystem?fileSystem = null, IEnvironmentHelper?environment = null, IActiveDebugFrameworkServices?activeDebugFramework = null, ProjectProperties?properties = null, IProjectThreadingService?threadingService = null, IVsDebugger10?debugger = null) { environment ??= Mock.Of <IEnvironmentHelper>(); tokenReplacer ??= IDebugTokenReplacerFactory.Create(); activeDebugFramework ??= IActiveDebugFrameworkServicesFactory.ImplementGetConfiguredProjectForActiveFrameworkAsync(configuredProject); threadingService ??= IProjectThreadingServiceFactory.Create(); debugger ??= IVsDebugger10Factory.ImplementIsIntegratedConsoleEnabled(enabled: false); IUnconfiguredProjectVsServices unconfiguredProjectVsServices = IUnconfiguredProjectVsServicesFactory.Implement(() => IVsHierarchyFactory.Create()); IRemoteDebuggerAuthenticationService remoteDebuggerAuthenticationService = Mock.Of <IRemoteDebuggerAuthenticationService>(); return(new ConsoleDebugTargetsProvider(unconfiguredProjectVsServices, configuredProject, tokenReplacer, fileSystem, environment, activeDebugFramework, properties, threadingService, IVsUIServiceFactory.Create <SVsShellDebugger, IVsDebugger10>(debugger), remoteDebuggerAuthenticationService)); }
public async Task DebugProfileEnumValuesGenerator_TryCreateEnumValueAsyncTests() { var testProfiles = new Mock <ILaunchSettings>(); testProfiles.Setup(m => m.ActiveProfile).Returns(() => { return(_profiles[1]); }); testProfiles.Setup(m => m.Profiles).Returns(() => { return(_profiles.ToImmutableList()); }); var moqProfileProvider = new Mock <ILaunchSettingsProvider>(); moqProfileProvider.Setup(p => p.CurrentSnapshot).Returns(testProfiles.Object); var threadingService = IProjectThreadingServiceFactory.Create(); var generator = new DebugProfileEnumValuesGenerator(moqProfileProvider.Object, threadingService); Assert.False(generator.AllowCustomValues); IEnumValue result = await generator.TryCreateEnumValueAsync("Profile1"); Assert.True(result.Name == "Profile1" && result.DisplayName == "Profile1"); result = await generator.TryCreateEnumValueAsync("MyCommand"); Assert.True(result.Name == "MyCommand" && result.DisplayName == "MyCommand"); // case sensitive check result = await generator.TryCreateEnumValueAsync("mycommand"); Assert.Null(result); result = await generator.TryCreateEnumValueAsync("Foo"); Assert.True(result.Name == "Foo" && result.DisplayName == "Foo"); result = await generator.TryCreateEnumValueAsync("Bar"); Assert.True(result.Name == "Bar" && result.DisplayName == "Bar"); }
public void VisualBasicProjectConfigurationProperties_OutputPath() { var setValues = new List <object>(); var project = UnconfiguredProjectFactory.Create(); var data = new PropertyPageData() { Category = ConfiguredBrowseObject.SchemaName, PropertyName = ConfiguredBrowseObject.OutputPathProperty, Value = "OldPath", SetValues = setValues }; var projectProperties = ProjectPropertiesFactory.Create(project, data); var vsLangProjectProperties = CreateInstance(projectProperties, IProjectThreadingServiceFactory.Create()); Assert.Equal("OldPath", vsLangProjectProperties.OutputPath); var testValue = "NewPath"; vsLangProjectProperties.OutputPath = testValue; Assert.Equal(setValues.Single(), testValue); }
public void VisualBasicProjectConfigurationProperties_CodeAnalysisRuleSet() { var setValues = new List <object>(); var project = UnconfiguredProjectFactory.Create(); var data = new PropertyPageData() { Category = ConfiguredBrowseObject.SchemaName, PropertyName = ConfiguredBrowseObject.CodeAnalysisRuleSetProperty, Value = "Blah", SetValues = setValues }; var projectProperties = ProjectPropertiesFactory.Create(project, data); var vsLangProjectProperties = CreateInstance(projectProperties, IProjectThreadingServiceFactory.Create()); Assert.Equal("Blah", vsLangProjectProperties.CodeAnalysisRuleSet); var testValue = "Testing"; vsLangProjectProperties.CodeAnalysisRuleSet = testValue; Assert.Equal(setValues.Single(), testValue); }
public void CSharpProjectConfigurationProperties_LangVersion() { var setValues = new List <object>(); var project = UnconfiguredProjectFactory.Create(); var data = new PropertyPageData() { Category = ConfiguredBrowseObject.SchemaName, PropertyName = ConfiguredBrowseObject.LangVersionProperty, Value = "6", SetValues = setValues }; var projectProperties = ProjectPropertiesFactory.Create(project, data); var vsLangProjectProperties = CreateInstance(projectProperties, IProjectThreadingServiceFactory.Create()); Assert.Equal("6", vsLangProjectProperties.LanguageVersion); var testValue = "7.1"; vsLangProjectProperties.LanguageVersion = testValue; Assert.Equal(setValues.Single(), testValue); }
public TestProjectFileOrAssemblyInfoPropertiesProvider( Workspace workspace, UnconfiguredProject unconfiguredProject, Lazy <IInterceptingPropertyValueProvider, IInterceptingPropertyValueProviderMetadata> interceptingProvider = null, IProjectThreadingService threadingService = null, IProjectProperties defaultProperties = null, IProjectInstancePropertiesProvider instanceProvider = null, Func <ProjectId> getActiveProjectId = null) : base(delegatedProvider : IProjectPropertiesProviderFactory.Create(defaultProperties ?? IProjectPropertiesFactory.MockWithProperty("").Object), instanceProvider : instanceProvider ?? IProjectInstancePropertiesProviderFactory.Create(), interceptingValueProviders : interceptingProvider == null ? new[] { new Lazy <IInterceptingPropertyValueProvider, IInterceptingPropertyValueProviderMetadata>( () => IInterceptingPropertyValueProviderFactory.Create(), IInterceptingPropertyValueProviderMetadataFactory.Create("")) } : new[] { interceptingProvider }, unconfiguredProject : unconfiguredProject, getActiveProjectId : getActiveProjectId ?? (() => workspace.CurrentSolution.ProjectIds.SingleOrDefault()), workspace : workspace, threadingService : threadingService ?? IProjectThreadingServiceFactory.Create()) { Requires.NotNull(workspace, nameof(workspace)); Requires.NotNull(unconfiguredProject, nameof(unconfiguredProject)); }
public DesignTimeInputsBuildManagerBridgeTests() { var threadingService = IProjectThreadingServiceFactory.Create(); var changeTracker = Mock.Of <IDesignTimeInputsChangeTracker>(); var compilerMock = new Mock <IDesignTimeInputsCompiler>(); compilerMock.Setup(c => c.GetDesignTimeInputXmlAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <ImmutableHashSet <string> >())) .Callback <string, string, ImmutableHashSet <string> >((file, outputPath, sharedInputs) => { _lastCompiledFile = file; _lastOutputPath = outputPath; _lastSharedInputs = sharedInputs; }); var project = UnconfiguredProjectFactory.Create(filePath: @"C:\MyProject\MyProject.csproj"); _buildManager = new TestBuildManager(); _bridge = new TestDesignTimeInputsBuildManagerBridge(project, threadingService, changeTracker, compilerMock.Object, _buildManager); _bridge.SkipInitialization = true; }
public async Task SqlDebugEnabled_OnSetPropertyValueAsync_SetsDirectoryInActiveProfile() { bool activeProfileSqlDebugEnabled = false; var activeProfileOtherSettings = new Dictionary <string, object> { { LaunchProfileExtensions.SqlDebuggingProperty, activeProfileSqlDebugEnabled } }; var settingsProvider = SetupLaunchSettingsProvider( activeProfileName: "One", activeProfileOtherSettings: activeProfileOtherSettings, updateLaunchSettingsCallback: s => { activeProfileSqlDebugEnabled = (bool)s.ActiveProfile !.OtherSettings[LaunchProfileExtensions.SqlDebuggingProperty]; }); var project = UnconfiguredProjectFactory.Create(); var threadingService = IProjectThreadingServiceFactory.Create(); var provider = new ActiveLaunchProfileExtensionValueProvider(project, settingsProvider, threadingService); await provider.OnSetPropertyValueAsync(ActiveLaunchProfileExtensionValueProvider.SqlDebuggingPropertyName, "true", Mock.Of <IProjectProperties>()); Assert.True(activeProfileSqlDebugEnabled); }
private EditProjectFileCommand SetupScenario(string projectXml, string tempPath, string tempProjectFile, string projectFile, IFileSystemMock fileSystem, ITextDocument textDoc, IVsWindowFrame frame, IExportFactory <IMsBuildModelWatcher> watcherFactory = null) { fileSystem.SetTempFile(tempPath); var configuredProject = ConfiguredProjectFactory.Create(); var unconfiguredProject = IUnconfiguredProjectFactory.Create(filePath: projectFile, configuredProject: configuredProject); var shellUtilities = new TestShellUtilitiesHelper((sp, path) => { Assert.Equal(tempProjectFile, path); return(Tuple.Create(IVsHierarchyFactory.Create(), (uint)0, IVsPersistDocDataFactory.ImplementAsIVsTextBuffer(), (uint)0)); }, (sp, path, factoryGuid, logicalView) => { Assert.Equal(tempProjectFile, path); Assert.Equal(XmlGuid, factoryGuid); Assert.Equal(Guid.Empty, logicalView); return(frame); }); var textBuffer = ITextBufferFactory.ImplementSnapshot(projectXml); var editorFactoryService = IVsEditorAdaptersFactoryServiceFactory.ImplementGetDocumentBuffer(textBuffer); Mock.Get(textDoc).SetupGet(t => t.TextBuffer).Returns(textBuffer); var textDocFactory = ITextDocumentFactoryServiceFactory.ImplementGetTextDocument(textDoc, true); var msbuildAccessor = IMsBuildAccessorFactory.ImplementGetProjectXmlRunLocked(projectXml, async(writeLock, callback) => { await callback(); Assert.True(writeLock); }); var threadingService = IProjectThreadingServiceFactory.Create(); return(CreateInstance(unconfiguredProject, true, msbuildAccessor, fileSystem, textDocFactory, editorFactoryService, threadingService, shellUtilities, watcherFactory)); }
public async Task RemoteMachineName_OnSetPropertyValueAsync_SetsDirectoryInActiveProfile() { string activeProfileRemoteMachineName = "Tiger"; var activeProfileOtherSettings = new Dictionary <string, object> { { LaunchProfileExtensions.RemoteDebugMachineProperty, activeProfileRemoteMachineName } }; var settingsProvider = SetupLaunchSettingsProvider( activeProfileName: "One", activeProfileOtherSettings: activeProfileOtherSettings, updateLaunchSettingsCallback: s => { activeProfileRemoteMachineName = (string)s.ActiveProfile !.OtherSettings[LaunchProfileExtensions.RemoteDebugMachineProperty]; }); var project = UnconfiguredProjectFactory.Create(); var threadingService = IProjectThreadingServiceFactory.Create(); var provider = new ActiveLaunchProfileExtensionValueProvider(project, settingsProvider, threadingService); await provider.OnSetPropertyValueAsync(ActiveLaunchProfileExtensionValueProvider.RemoteDebugMachinePropertyName, "Cheetah", Mock.Of <IProjectProperties>()); Assert.Equal(expected: "Cheetah", actual: activeProfileRemoteMachineName); }
private static DesignTimeInputsFileWatcher CreateDesignTimeInputsFileWatcher(IVsAsyncFileChangeEx fileChangeService, out ProjectValueDataSource <DesignTimeInputs> source) { // Create our mock design time inputs data source, but with a source we can actually use var services = IProjectCommonServicesFactory.CreateWithDefaultThreadingPolicy(); source = ProjectValueDataSourceFactory.Create <DesignTimeInputs>(services); var mock = new Mock <IDesignTimeInputsDataSource>(); mock.SetupGet(s => s.SourceBlock) .Returns(source.SourceBlock); var dataSource = mock.Object; var threadingService = IProjectThreadingServiceFactory.Create(); var unconfiguredProject = UnconfiguredProjectFactory.Create(fullPath: @"C:\MyProject\MyProject.csproj"); var unconfiguredProjectServices = IUnconfiguredProjectServicesFactory.Create( projectService: IProjectServiceFactory.Create( services: ProjectServicesFactory.Create( threadingService: threadingService))); // Create our class under test return(new DesignTimeInputsFileWatcher(unconfiguredProject, unconfiguredProjectServices, threadingService, dataSource, IVsServiceFactory.Create <SVsFileChangeEx, IVsAsyncFileChangeEx>(fileChangeService))); }
internal LaunchSettingsUnderTest GetLaunchSettingsProvider(IFileSystem fileSystem, string appDesignerFolder = @"c:\test\Project1\Properties", string activeProfile = "") { var activeProfileValue = new Mock <IEnumValue>(); activeProfileValue.Setup(s => s.Name).Returns(activeProfile); var debuggerData = new PropertyPageData() { Category = ProjectDebugger.SchemaName, PropertyName = ProjectDebugger.ActiveDebugProfileProperty, Value = activeProfileValue.Object }; var specialFilesManager = ActiveConfiguredProjectFactory.ImplementValue(() => AppDesignerFolderSpecialFileProviderFactory.ImplementGetFile(appDesignerFolder)); var project = UnconfiguredProjectFactory.Create(filePath: @"c:\test\Project1\Project1.csproj"); var properties = ProjectPropertiesFactory.Create(project, new[] { debuggerData }); var commonServices = IUnconfiguredProjectCommonServicesFactory.Create(project, null, IProjectThreadingServiceFactory.Create(), null, properties); var projectServices = IUnconfiguredProjectServicesFactory.Create(IProjectAsynchronousTasksServiceFactory.Create()); var provider = new LaunchSettingsUnderTest(project, projectServices, fileSystem ?? new IFileSystemMock(), commonServices, null, specialFilesManager); return(provider); }
public void OutputTypeEx() { var setValues = new List <object>(); var project = UnconfiguredProjectFactory.Create(); var data = new PropertyPageData() { Category = ConfigurationGeneralBrowseObject.SchemaName, PropertyName = ConfigurationGeneralBrowseObject.OutputTypeProperty, Value = 4, SetValues = setValues }; var projectProperties = ProjectPropertiesFactory.Create(project, data); var activeConfiguredProject = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties); var vsLangProjectProperties = CreateInstance(Mock.Of <VSLangProj.VSProject>(), IProjectThreadingServiceFactory.Create(), activeConfiguredProject); Assert.Equal(prjOutputTypeEx.prjOutputTypeEx_AppContainerExe, vsLangProjectProperties.OutputTypeEx); vsLangProjectProperties.OutputTypeEx = prjOutputTypeEx.prjOutputTypeEx_WinExe; Assert.Equal(setValues.Single().ToString(), prjOutputTypeEx.prjOutputTypeEx_WinExe.ToString()); }
public void AbsoluteProjectDirectory() { var project = UnconfiguredProjectFactory.Create(); var data = new PropertyPageData() { Category = ConfigurationGeneralBrowseObject.SchemaName, PropertyName = ConfigurationGeneralBrowseObject.FullPathProperty, Value = "testvalue", }; var projectProperties = ProjectPropertiesFactory.Create(project, data); var activeConfiguredProject = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties); var vsLangProjectProperties = CreateInstance(Mock.Of <VSLangProj.VSProject>(), IProjectThreadingServiceFactory.Create(), activeConfiguredProject); Assert.Equal("testvalue", vsLangProjectProperties.AbsoluteProjectDirectory); }
public void AssemblyName() { var setValues = new List <object>(); var project = UnconfiguredProjectFactory.Create(); var data = new PropertyPageData() { Category = ConfigurationGeneral.SchemaName, PropertyName = ConfigurationGeneral.AssemblyNameProperty, Value = "Blah", SetValues = setValues }; var projectProperties = ProjectPropertiesFactory.Create(project, data); var activeConfiguredProject = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties); var vsLangProjectProperties = CreateInstance(Mock.Of <VSLangProj.VSProject>(), IProjectThreadingServiceFactory.Create(), activeConfiguredProject); Assert.Equal("Blah", vsLangProjectProperties.AssemblyName); var testValue = "Testing"; vsLangProjectProperties.AssemblyName = testValue; Assert.Equal(setValues.Single(), testValue); }
public void FullPath() { var project = UnconfiguredProjectFactory.Create(); var data = new PropertyPageData(ConfigurationGeneral.SchemaName, ConfigurationGeneral.ProjectDirProperty, "somepath"); var projectProperties = ProjectPropertiesFactory.Create(project, data); var activeConfiguredProject = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties); var vsLangProjectProperties = CreateInstance(Mock.Of <VSLangProj.VSProject>(), IProjectThreadingServiceFactory.Create(), activeConfiguredProject); Assert.Equal("somepath", vsLangProjectProperties.FullPath); }
public void OutputType() { var setValues = new List <object>(); var project = UnconfiguredProjectFactory.Create(); var data = new PropertyPageData(ConfigurationGeneralBrowseObject.SchemaName, ConfigurationGeneralBrowseObject.OutputTypeProperty, 1, setValues); var projectProperties = ProjectPropertiesFactory.Create(project, data); var activeConfiguredProject = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties); var vsLangProjectProperties = CreateInstance(Mock.Of <VSLangProj.VSProject>(), IProjectThreadingServiceFactory.Create(), activeConfiguredProject); Assert.Equal(prjOutputType.prjOutputTypeExe, vsLangProjectProperties.OutputType); vsLangProjectProperties.OutputType = prjOutputType.prjOutputTypeLibrary; Assert.Equal(prjOutputType.prjOutputTypeLibrary, setValues.Single()); }
public void Constructor_NullAsGeneratePackageOnBuildPropertyProvider_ThrowsArgumentNull() { Assert.Throws <ArgumentNullException>(() => CreateInstanceCore(UnconfiguredProjectFactory.Create(), IProjectThreadingServiceFactory.Create(), SVsServiceProviderFactory.Create(null), null)); }
public void NullEditorState_Throws() { Assert.Throws <ArgumentNullException>("editorState", () => new TempFileBufferStateListener(null, IVsEditorAdaptersFactoryServiceFactory.Create(), ITextDocumentFactoryServiceFactory.Create(), IProjectThreadingServiceFactory.Create(), IVsShellUtilitiesHelperFactory.Create(), IServiceProviderFactory.Create())); }
public async Task ScheduleAsyncTask_Noop_OriginalSourceTokenCancelled() { var cts = new CancellationTokenSource(); using (var scheduler = new TaskDelayScheduler(TimeSpan.FromMilliseconds(250), IProjectThreadingServiceFactory.Create(), cts.Token)) { cts.Cancel(); bool taskRan = false; var task = scheduler.ScheduleAsyncTask(ct => { taskRan = true; return(Task.CompletedTask); }); await task; Assert.False(taskRan); } }
public async Task Dispose_SkipsPendingTasks() { using (var scheduler = new TaskDelayScheduler(TimeSpan.FromMilliseconds(250), IProjectThreadingServiceFactory.Create(), CancellationToken.None)) { bool taskRan = false; var task = scheduler.ScheduleAsyncTask(ct => { taskRan = true; return(Task.CompletedTask); }); scheduler.Dispose(); await task; Assert.False(taskRan); } }