public BuildUpToDateCheckTests(ITestOutputHelper output) { _output = output; // NOTE most of these mocks are only present to prevent NREs in Initialize // Enable "Info" log level, as we assert logged messages in tests var projectSystemOptions = new Mock <IProjectSystemOptions>(); projectSystemOptions.Setup(o => o.GetFastUpToDateLoggingLevelAsync(It.IsAny <CancellationToken>())) .ReturnsAsync(LogLevel.Info); projectSystemOptions.Setup(o => o.GetIsFastUpToDateCheckEnabledAsync(It.IsAny <CancellationToken>())) .ReturnsAsync(() => _isFastUpToDateCheckEnabled); var projectCommonServices = IProjectCommonServicesFactory.CreateWithDefaultThreadingPolicy(); var jointRuleSource = new ProjectValueDataSource <IProjectSubscriptionUpdate>(projectCommonServices); var sourceItemsRuleSource = new ProjectValueDataSource <IProjectSubscriptionUpdate>(projectCommonServices); var projectSubscriptionService = new Mock <IProjectSubscriptionService>(); projectSubscriptionService.SetupGet(o => o.JointRuleSource).Returns(jointRuleSource); projectSubscriptionService.SetupGet(o => o.SourceItemsRuleSource).Returns(sourceItemsRuleSource); var configuredProjectServices = ConfiguredProjectServicesFactory.Create(projectSubscriptionService: projectSubscriptionService.Object); var configuredProject = new Mock <ConfiguredProject>(); configuredProject.SetupGet(c => c.ProjectVersion).Returns(() => _projectVersion); configuredProject.SetupGet(c => c.Services).Returns(configuredProjectServices); configuredProject.SetupGet(c => c.UnconfiguredProject).Returns(UnconfiguredProjectFactory.Create(filePath: _projectFullPath)); var projectAsynchronousTasksService = new Mock <IProjectAsynchronousTasksService>(); projectAsynchronousTasksService.SetupGet(s => s.UnloadCancellationToken).Returns(CancellationToken.None); projectAsynchronousTasksService.Setup(s => s.IsTaskQueueEmpty(ProjectCriticalOperation.Build)).Returns(() => _isTaskQueueEmpty); var lastWriteTimeUtc = new DateTime(1999, 1, 1, 0, 0, 0, DateTimeKind.Utc); _fileSystem = new IFileSystemMock(); _fileSystem.AddFile(_msBuildProjectFullPath, lastWriteTimeUtc); _fileSystem.AddFile("Project1", lastWriteTimeUtc); _fileSystem.AddFile("Project2", lastWriteTimeUtc); _fileSystem.AddFolder(_msBuildProjectDirectory); _fileSystem.AddFolder(_outputPath); var threadingService = IProjectThreadingServiceFactory.Create(); _buildUpToDateCheck = new BuildUpToDateCheck( projectSystemOptions.Object, configuredProject.Object, projectAsynchronousTasksService.Object, IProjectItemSchemaServiceFactory.Create(), ITelemetryServiceFactory.Create(telemetryParameters => _telemetryEvents.Add(telemetryParameters)), threadingService, _fileSystem); }
public void ValidateSettingsWorkingDir() { string executable = null; string workingDir = null; var debugger = GetDebugTargetsProvider(); var profileName = "run"; // No path elements should be ok. Expect it to be on the path executable = @"bar.exe"; debugger.ValidateSettings(executable, workingDir, profileName); try { workingDir = @"c:\foo"; debugger.ValidateSettings(executable, workingDir, profileName); Assert.True(false); } catch (Exception ex) { Assert.True(ex.Message.Equals(string.Format(VSResources.WorkingDirecotryInvalid, workingDir, profileName))); _mockFS.AddFolder(workingDir); debugger.ValidateSettings(executable, workingDir, profileName); Assert.True(true); } }
public void ValidateSettings_WhenWorkingDirFound_DoesNotThrow() { string executable = "bar.exe"; string workingDir = "c:\foo"; var debugger = GetDebugTargetsProvider(); var profileName = "run"; _mockFS.AddFolder(workingDir); debugger.ValidateSettings(executable, workingDir, profileName); Assert.True(true); }