public void ProjectExcludePropertyToggleCommand_QueryStatus_MultipleProjects_AllSupportedProjects_IsEnabledIsVisible() { // Setup OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); var testSubject = new ProjectExcludePropertyToggleCommand(this.serviceProvider); var p1 = new ProjectMock("good1.proj"); var p2 = new ProjectMock("good2.proj"); p1.SetCSProjectKind(); p2.SetCSProjectKind(); this.projectSystem.SelectedProjects = new [] { p1, p2 }; // Act testSubject.QueryStatus(command, null); // Verify Assert.IsTrue(command.Enabled, "Expected command to be enabled"); Assert.IsTrue(command.Visible, "Expected command to be visible"); }
public void ProjectExcludePropertyToggleCommand_QueryStatus_MultipleProjects_MixedSupportedProject_IsDisabledIsHidden() { // Setup OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); var testSubject = new ProjectExcludePropertyToggleCommand(this.serviceProvider); var unsupportedProject = new ProjectMock("bad.proj"); var supportedProject = new ProjectMock("good.proj"); supportedProject.SetCSProjectKind(); this.projectSystem.SelectedProjects = new[] { unsupportedProject, supportedProject }; // Act testSubject.QueryStatus(command, null); // Verify Assert.IsFalse(command.Enabled, "Expected command to be disabled"); Assert.IsFalse(command.Visible, "Expected command to be hidden"); }
public void ProjectExcludePropertyToggleCommand_QueryStatus_MultipleProjects_MixedPropValues_IsUnchecked() { // Setup OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); var testSubject = new ProjectExcludePropertyToggleCommand(this.serviceProvider); var p1 = new ProjectMock("good1.proj"); var p2 = new ProjectMock("good2.proj"); var p3 = new ProjectMock("good3.proj"); p1.SetCSProjectKind(); p2.SetCSProjectKind(); p3.SetCSProjectKind(); this.projectSystem.SelectedProjects = new[] { p1, p2, p3 }; this.SetExcludeProperty(p1, true); this.SetExcludeProperty(p2, null); this.SetExcludeProperty(p3, false); // Act testSubject.QueryStatus(command, null); // Verify Assert.IsFalse(command.Checked, "Expected command to be unchecked"); }
public void ProjectExcludePropertyToggleCommand_QueryStatus_MultipleProjects_ConsistentPropValues_CheckedStateReflectsValues() { // Setup OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); var testSubject = new ProjectExcludePropertyToggleCommand(this.serviceProvider); var p1 = new ProjectMock("good1.proj"); var p2 = new ProjectMock("good2.proj"); p1.SetCSProjectKind(); p2.SetCSProjectKind(); this.projectSystem.SelectedProjects = new[] { p1, p2 }; // Test case 1: no property -> not checked // Act testSubject.QueryStatus(command, null); // Verify Assert.IsFalse(command.Checked, "Expected command to be unchecked"); // Test case 2: all true -> is checked this.SetExcludeProperty(p1, true); this.SetExcludeProperty(p2, true); // Act testSubject.QueryStatus(command, null); // Verify Assert.IsTrue(command.Checked, "Expected command to be checked"); }
public void ProjectExcludePropertyToggleCommand_QueryStatus_SingleProject_CheckedStateReflectsValues() { // Setup OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); var testSubject = new ProjectExcludePropertyToggleCommand(this.serviceProvider); var project = new ProjectMock("face.proj"); project.SetCSProjectKind(); this.projectSystem.SelectedProjects = new[] { project }; // Test case 1: no property -> not checked // Act testSubject.QueryStatus(command, null); // Verify Assert.IsFalse(command.Checked, "Expected command to be unchecked"); // Test case 1: true -> is checked this.SetExcludeProperty(project, true); // Act testSubject.QueryStatus(command, null); // Verify Assert.IsTrue(command.Checked, "Expected command to be checked"); }
public void ProjectExcludePropertyToggleCommand_QueryStatus_SingleProject_UnsupportedProject_IsDisabledIsHidden() { // Setup OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); var testSubject = new ProjectExcludePropertyToggleCommand(serviceProvider); var project = new ProjectMock("mcproject.csproj"); this.projectSystem.SelectedProjects = new[] { project }; // Act testSubject.QueryStatus(command, null); // Verify Assert.IsFalse(command.Enabled, "Expected command to be disabled"); Assert.IsFalse(command.Visible, "Expected command to be hidden"); }
public void ProjectExcludePropertyToggleCommand_QueryStatus_MissingPropertyManager_IsDisabledIsHidden() { // Setup OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); var localProvider = new ConfigurableServiceProvider(assertOnUnexpectedServiceRequest: false); ProjectExcludePropertyToggleCommand testSubject; using (new AssertIgnoreScope()) // we want to be missing the MEF service { testSubject = new ProjectExcludePropertyToggleCommand(localProvider); } // Act testSubject.QueryStatus(command, null); // Verify Assert.IsFalse(command.Enabled, "Expected command to be disabled"); Assert.IsFalse(command.Visible, "Expected command to be hidden"); }