public void ProjectTestPropertySetCommand_Invoke_SingleProject_SetsValue() { // Arrange OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); command.Enabled = true; var project = new ProjectMock("project.csproj"); project.SetCSProjectKind(); this.projectSystem.SelectedProjects = new[] { project }; // Test case 1: test (true) // Arrange var testSubject1 = new ProjectTestPropertySetCommand(propertyManager, true); // Act testSubject1.Invoke(command, null); // Assert this.VerifyTestProperty(project, true); // Test case 2: non-test (false) var testSubject2 = new ProjectTestPropertySetCommand(propertyManager, false); // Act testSubject2.Invoke(command, null); // Assert this.VerifyTestProperty(project, false); // Test case 3: auto detect (null) var testSubject3 = new ProjectTestPropertySetCommand(propertyManager, null); // Act testSubject3.Invoke(command, null); // Assert this.VerifyTestProperty(project, null); }
public void ProjectTestPropertySetCommand_Invoke_MultipleProjects_MixedPropValues_SetsValues() { // Arrange OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); command.Enabled = true; var p1 = new ProjectMock("good1.proj"); var p2 = new ProjectMock("good2.proj"); var p3 = new ProjectMock("good2.proj"); p1.SetCSProjectKind(); p2.SetCSProjectKind(); p3.SetCSProjectKind(); this.projectSystem.SelectedProjects = new[] { p1, p2, p3 }; // Test case 1: test (true) // Arrange var testSubject1 = new ProjectTestPropertySetCommand(propertyManager, true); this.SetTestProperty(p1, null); this.SetTestProperty(p2, true); this.SetTestProperty(p3, false); // Act testSubject1.Invoke(command, null); // Assert this.VerifyTestProperty(p1, true); this.VerifyTestProperty(p2, true); this.VerifyTestProperty(p3, true); // Test case 2: non-test (false) var testSubject2 = new ProjectTestPropertySetCommand(propertyManager, false); this.SetTestProperty(p1, null); this.SetTestProperty(p2, true); this.SetTestProperty(p3, false); // Act testSubject2.Invoke(command, null); // Assert this.VerifyTestProperty(p1, false); this.VerifyTestProperty(p2, false); this.VerifyTestProperty(p3, false); // Test case 3: auto detect (null) var testSubject3 = new ProjectTestPropertySetCommand(propertyManager, null); this.SetTestProperty(p1, null); this.SetTestProperty(p2, true); this.SetTestProperty(p3, false); // Act testSubject3.Invoke(command, null); // Assert this.VerifyTestProperty(p1, null); this.VerifyTestProperty(p2, null); this.VerifyTestProperty(p3, null); }