public void ProjectBindingOperation_Commit_LegacyProjectSystem_DoesAddFile() { // Arrange ProjectBindingOperation testSubject = this.CreateTestSubject(); this.projectMock.SetCSProjectKind(); this.ruleStore.RegisterConfigFilePath(Language.CSharp, @"c:\Solution\sln.ruleset"); PropertyMock prop = CreateProperty(this.projectMock, "config1", ProjectBindingOperation.DefaultProjectRuleSet); testSubject.Initialize(); testSubject.Prepare(CancellationToken.None); this.projectSystemHelper.SetIsLegacyProjectSystem(true); // Act using (new AssertIgnoreScope()) // Ignore that the file is not on disk { testSubject.Commit(); } // Assert string projectFile = Path.Combine(Path.GetDirectoryName(this.projectMock.FilePath), Path.GetFileNameWithoutExtension(this.projectMock.FilePath) + ".ruleset"); prop.Value.ToString().Should().Be(Path.GetFileName(projectFile), "Should update the property value"); this.projectMock.Files.ContainsKey(projectFile).Should().BeTrue("Should add the file to the project for the legacy project system"); }
public void ProjectBindingOperation_Commit() { // Setup this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper); ProjectBindingOperation testSubject = this.CreateTestSubject(); this.projectMock.SetCSProjectKind(); this.ruleStore.RegisterRuleSetPath(Language.CSharp, @"c:\Solution\sln.ruleset"); PropertyMock prop = CreateProperty(this.projectMock, "config1", ProjectBindingOperation.DefaultProjectRuleSet); testSubject.Initialize(); testSubject.Prepare(CancellationToken.None); // Act using (new AssertIgnoreScope()) // Ignore that the file is not on disk { testSubject.Commit(); } // Verify string expectedFile = Path.Combine(Path.GetDirectoryName(this.projectMock.FilePath), Path.GetFileNameWithoutExtension(this.projectMock.FilePath) + ".ruleset"); Assert.AreEqual(Path.GetFileName(expectedFile), prop.Value.ToString(), "Should update the property value"); Assert.IsTrue(this.projectMock.Files.ContainsKey(expectedFile), "Should be added to the project"); }