public void ManageConnectionsCommand_QueryStatus() { // Arrange OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); // Test case 1: no TE controller // Arrange command.Enabled = false; var testSubject1 = new ManageConnectionsCommand(null); // Act testSubject1.QueryStatus(command, null); // Assert command.Enabled.Should().BeFalse("Expected the command to be disabled on QueryStatus when no TE controller"); // Test case 2: has TE controller // Arrange var teController = new ConfigurableTeamExplorerController(); var testSubject2 = new ManageConnectionsCommand(teController); // Act testSubject2.QueryStatus(command, null); // Assert command.Enabled.Should().BeTrue("Expected the command to be disabled on QueryStatus when does have TE controller"); }
public void ManageConnectionsCommand_QueryStatus() { // Arrange OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); // Test case 1: no TE controller // Arrange IServiceProvider sp1 = CreateServiceProviderWithEmptyComponentModel(); command.Enabled = false; ManageConnectionsCommand testSubject1; using (new AssertIgnoreScope()) // TE service is missing from MEF { testSubject1 = new ManageConnectionsCommand(null); } // Act testSubject1.QueryStatus(command, null); // Assert command.Enabled.Should().BeFalse("Expected the command to be disabled on QueryStatus when no TE controller"); // Test case 2: has TE controller // Arrange var teController = new ConfigurableTeamExplorerController(); var testSubject2 = new ManageConnectionsCommand(teController); // Act testSubject2.QueryStatus(command, null); // Assert command.Enabled.Should().BeTrue("Expected the command to be disabled on QueryStatus when does have TE controller"); }
public void ManageConnectionsCommand_QueryStatus() { // Setup OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); // Test case 1: no TE controller // Setup IServiceProvider sp1 = CreateServiceProviderWithEmptyComponentModel(); command.Enabled = false; ManageConnectionsCommand testSubject1; using (new AssertIgnoreScope()) // TE service is missing from MEF { testSubject1 = new ManageConnectionsCommand(sp1); } // Act testSubject1.QueryStatus(command, null); // Verify Assert.IsFalse(command.Enabled, "Expected the command to be disabled on QueryStatus when no TE controller"); // Test case 2: has TE controller // Setup var teController = new ConfigurableTeamExplorerController(); var sp2 = CreateServiceProviderWithMefExports <ITeamExplorerController>(teController); var testSubject2 = new ManageConnectionsCommand(sp2); // Act testSubject2.QueryStatus(command, null); // Verify Assert.IsTrue(command.Enabled, "Expected the command to be disabled on QueryStatus when does have TE controller"); }