public void BindingController_BindCommand_Status_VsState() { // Arrange BindCommandArgs bindArgs = CreateBindingArguments("proj1", "name1", "http://localhost:9000"); BindingController testSubject = this.PrepareCommandForExecution(); ProjectMock project1 = this.solutionMock.Projects.Single(); // Case 1: SolutionExistsAndFullyLoaded is not active this.monitorSelection.SetContext(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid, false); // Act + Assert testSubject.BindCommand.CanExecute(bindArgs).Should().BeFalse("No UI context: SolutionExistsAndFullyLoaded"); // Case 2: SolutionExistsAndNotBuildingAndNotDebugging is not active this.monitorSelection.SetContext(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid, true); this.monitorSelection.SetContext(VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid, false); // Act + Assert testSubject.BindCommand.CanExecute(bindArgs).Should().BeFalse("No UI context: SolutionExistsAndNotBuildingAndNotDebugging"); // Case 3: Non-managed project kind this.monitorSelection.SetContext(VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid, true); this.projectSystemHelper.Projects = null; // Act + Assert testSubject.BindCommand.CanExecute(bindArgs).Should().BeFalse("No managed projects"); // Case 4: No projects at all solutionMock.RemoveProject(project1); // Act + Assert testSubject.BindCommand.CanExecute(bindArgs).Should().BeFalse("No projects"); }
public void BindingController_SetBindingInProgress() { // Arrange ProjectViewModel projectVM = CreateProjectViewModel(); BindingController testSubject = this.PrepareCommandForExecution(); var progressEvents = new ConfigurableProgressEvents(); foreach (var controllerResult in (ProgressControllerResult[])Enum.GetValues(typeof(ProgressControllerResult))) { this.dteMock.ToolWindows.SolutionExplorer.Window.Active = false; // Sanity testSubject.BindCommand.CanExecute(projectVM).Should().BeTrue(); // Act - disable testSubject.SetBindingInProgress(progressEvents, projectVM.ProjectInformation); // Assert testSubject.BindCommand.CanExecute(projectVM).Should().BeFalse("Binding is in progress so should not be enabled"); // Act - finish progressEvents.SimulateFinished(controllerResult); // Assert testSubject.BindCommand.CanExecute(projectVM).Should().BeTrue("Binding is finished with result: {0}", controllerResult); if (controllerResult == ProgressControllerResult.Succeeded) { this.dteMock.ToolWindows.SolutionExplorer.Window.Active.Should().BeTrue("SolutionExplorer window supposed to be activated"); } else { this.dteMock.ToolWindows.SolutionExplorer.Window.Active.Should().BeFalse("SolutionExplorer window is not supposed to be activated"); } } }
public void Compile() { Document wordDoc = Globals.BookPublishingStartup.Application.ActiveDocument; Controller = new BindingController(wordDoc, Assembly, this); Controller.ProcessAssembly(); }
public void BindingController_BindingFinished() { // Arrange ServerViewModel serverVM = CreateServerViewModel(); serverVM.SetProjects(new[] { new SonarQubeProject("key1", "") }); ProjectViewModel projectVM = serverVM.Projects.First(); BindingController testSubject = this.PrepareCommandForExecution(); this.host.VisualStateManager.ManagedState.ConnectedServers.Add(serverVM); var progressEvents = new ConfigurableProgressEvents(); foreach (ProgressControllerResult result in Enum.GetValues(typeof(ProgressControllerResult)).OfType <ProgressControllerResult>()) { // Arrange testSubject.SetBindingInProgress(progressEvents, projectVM.Project); testSubject.IsBindingInProgress.Should().BeTrue(); // Act progressEvents.SimulateFinished(result); // Assert testSubject.IsBindingInProgress.Should().BeFalse(); if (result == ProgressControllerResult.Succeeded) { this.host.TestStateManager.BoundProject.Should().Be(projectVM.Project); } else { this.host.TestStateManager.BoundProject.Should().BeNull(); } } }
public void BindingController_BindCommand_Status() { // Arrange BindCommandArgs bindingArgs = CreateBindingArguments("key1", "name1", "http://localhost"); BindingController testSubject = this.PrepareCommandForExecution(); // Case 1: All the requirements are set // Act + Assert testSubject.BindCommand.CanExecute(bindingArgs).Should().BeTrue("All the requirement should be satisfied for the command to be enabled"); // Case 2: project is null // Act + Assert testSubject.BindCommand.CanExecute(null) .Should().BeFalse("Project is null"); // Case 3: No connection this.host.TestStateManager.IsConnected = false; // Act + Assert testSubject.BindCommand.CanExecute(bindingArgs) .Should().BeFalse("No connection"); // Case 4: busy this.host.TestStateManager.IsConnected = true; this.host.VisualStateManager.IsBusy = true; // Act + Assert testSubject.BindCommand.CanExecute(bindingArgs) .Should().BeFalse("Connecting"); }
public void UpdateBoundElements(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (BindingController.GetElementsByProperty(e.PropertyName) != null) { foreach (var boundElement in BindingController.GetElementsByProperty(e.PropertyName)) { var uivalue = sender.GetType().GetProperty(e.PropertyName).GetValue(sender, null); var bindingEl = boundElement.GetComponent <PropertyBinding>(); switch (bindingEl.Type) { case "Text": UpdateTextComponent(bindingEl, uivalue); break; case "Image": Sprite sprite = uivalue as Sprite; boundElement.GetComponent <Image>().sprite = sprite; break; default: break; } } } }
public void BindingController_BindingFinished() { // Arrange var bindingArgs = new BindCommandArgs("key1", "name1", new ConnectionInformation(new Uri("http://localhost"))); BindingController testSubject = this.PrepareCommandForExecution(); var progressEvents = new ConfigurableProgressEvents(); foreach (ProgressControllerResult result in Enum.GetValues(typeof(ProgressControllerResult)).OfType <ProgressControllerResult>()) { // Arrange testSubject.SetBindingInProgress(progressEvents, bindingArgs); testSubject.IsBindingInProgress.Should().BeTrue(); // Act progressEvents.SimulateFinished(result); // Assert testSubject.IsBindingInProgress.Should().BeFalse(); if (result == ProgressControllerResult.Succeeded) { this.host.TestStateManager.AssignedProjectKey.Should().Be("key1"); } else { this.host.TestStateManager.AssignedProjectKey.Should().BeNull(); } } }
public void BindingController_BindCommand_Execution() { // Arrange BindingController testSubject = this.PrepareCommandForExecution(); // Act var projectToBind1 = new ProjectInformation { Key = "1" }; ProjectViewModel projectVM1 = CreateProjectViewModel(projectToBind1); testSubject.BindCommand.Execute(projectVM1); // Assert this.workflow.BoundProject.Should().Be(projectToBind1); // Act, bind a different project var projectToBind2 = new ProjectInformation { Key = "2" }; ProjectViewModel projectVM2 = CreateProjectViewModel(projectToBind2); testSubject.BindCommand.Execute(projectVM2); // Assert this.workflow.BoundProject.Should().Be(projectToBind2); }
public void BindingController_BindCommand_Status() { // Setup ProjectViewModel projectVM = CreateProjectViewModel(); BindingController testSubject = this.PrepareCommandForExecution(); // Case 1: All the requirements are set // Act + Verify Assert.IsTrue(testSubject.BindCommand.CanExecute(projectVM), "All the requirement should be satisfied for the command to be enabled"); // Case 2: project is null // Act + Verify Assert.IsFalse(testSubject.BindCommand.CanExecute(null), "Project is null"); // Case 3: No connection this.host.TestStateManager.IsConnected = false; // Act + Verify Assert.IsFalse(testSubject.BindCommand.CanExecute(projectVM), "No connection"); // Case 4: busy this.host.TestStateManager.IsConnected = true; this.host.VisualStateManager.IsBusy = true; // Act + Verify Assert.IsFalse(testSubject.BindCommand.CanExecute(projectVM), "Connecting"); }
public void BindingController_BindCommand_Status_VsState() { // Setup ProjectViewModel projectVM = CreateProjectViewModel(); BindingController testSubject = this.PrepareCommandForExecution(); ProjectMock project1 = this.solutionMock.Projects.Single(); // Case 1: SolutionExistsAndFullyLoaded is not active this.monitorSelection.SetContext(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid, false); // Act + Verify Assert.IsFalse(testSubject.BindCommand.CanExecute(projectVM), "No UI context: SolutionExistsAndFullyLoaded"); // Case 2: SolutionExistsAndNotBuildingAndNotDebugging is not active this.monitorSelection.SetContext(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid, true); this.monitorSelection.SetContext(VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid, false); // Act + Verify Assert.IsFalse(testSubject.BindCommand.CanExecute(projectVM), "No UI context: SolutionExistsAndNotBuildingAndNotDebugging"); // Case 3: Non-managed project kind this.monitorSelection.SetContext(VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid, true); this.projectSystemHelper.Projects = null; // Act + Verify Assert.IsFalse(testSubject.BindCommand.CanExecute(projectVM), "No managed projects"); // Case 4: No projects at all solutionMock.RemoveProject(project1); // Act + Verify Assert.IsFalse(testSubject.BindCommand.CanExecute(projectVM), "No projects"); }
public void BindingController_Ctor() { // Arrange BindingController testSubject = this.CreateBindingController(); // Assert testSubject.BindCommand.Should().NotBeNull("The Bind command should never be null"); }
// Update is called once per frame private void Start() { Number++; NewFontStyle = FontStyle.BoldAndItalic; Number3 = 100; //NewColor = Color.red; List <GameObject> items = BindingController.GetElementsByProperty("Number"); }
public void BindingController_Ctor() { // Setup BindingController testSubject = this.CreateBindingController(); // Verify Assert.IsNotNull(testSubject.BindCommand, "The Bind command should never be null"); }
public void BindingController_BindingFinished_Navigation() { // Arrange ServerViewModel serverVM = CreateServerViewModel(); serverVM.SetProjects(new[] { new ProjectInformation { Key = "key1" } }); ProjectViewModel projectVM = serverVM.Projects.First(); BindingController testSubject = this.PrepareCommandForExecution(); this.host.VisualStateManager.ManagedState.ConnectedServers.Add(serverVM); var progressEvents = new ConfigurableProgressEvents(); var teController = new ConfigurableTeamExplorerController(); var mefExports = MefTestHelpers.CreateExport <ITeamExplorerController>(teController); var mefModel = ConfigurableComponentModel.CreateWithExports(mefExports); serviceProvider.RegisterService(typeof(SComponentModel), mefModel, replaceExisting: true); // Case 1: On non-successful binding no navigation will occur foreach (ProgressControllerResult nonSuccuess in new[] { ProgressControllerResult.Cancelled, ProgressControllerResult.Failed }) { // Act testSubject.SetBindingInProgress(progressEvents, projectVM.ProjectInformation); progressEvents.SimulateFinished(nonSuccuess); // Assert teController.ShowConnectionsPageCallsCount.Should().Be(0); this.dteMock.ToolWindows.SolutionExplorer.Window.Active.Should().BeFalse(); } // Case 2: Has conflicts (should navigate to team explorer page) this.conflictsController.HasConflicts = true; // Act testSubject.SetBindingInProgress(progressEvents, projectVM.ProjectInformation); progressEvents.SimulateFinished(ProgressControllerResult.Succeeded); // Assert teController.ShowConnectionsPageCallsCount.Should().Be(1); this.dteMock.ToolWindows.SolutionExplorer.Window.Active.Should().BeFalse(); // Case 3: Has no conflicts (should navigate to solution explorer) this.conflictsController.HasConflicts = false; // Act testSubject.SetBindingInProgress(progressEvents, projectVM.ProjectInformation); progressEvents.SimulateFinished(ProgressControllerResult.Succeeded); // Assert teController.ShowConnectionsPageCallsCount.Should().Be(1); this.dteMock.ToolWindows.SolutionExplorer.Window.Active.Should().BeTrue(); }
public void BindingController_Ctor_ArgumentChecks() { BindingController suppressAnalysisWarning; Exceptions.Expect <ArgumentNullException>(() => { suppressAnalysisWarning = new BindingController(null); }); }
protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } BindingController.Clear(chVisualizacion, "Checked", this, "LoadFromFile"); } base.Dispose(disposing); }
private void InitEventHandlers() { BindingController.Bind(this, "IdResponsable", _comprobanteDePago, "IdResponsable"); _comprobanteDePago.ObjectHasChanged += new EventHandler(_comprobanteDePago_ObjectHasChanged); _comprobanteDePago.OnTaskAfterExecute += new EventHandler(_comprobanteDePago_OnTaskAfterExecute); //German 20120125 - Tarea 0000256 _comprobanteDePago.SaldoAImputarChanged += new EventHandler(_comprobanteDePago_SaldoAImputarChanged); //Fin German 20120125 - Tarea 0000256 //German 20120510 - Tarea 0000323 _comprobanteDePago.NumeroSugeridoChanged += new EventHandler(_comprobanteDePago_NumeroSugeridoChanged); //Fin German 20120510 - Tarea 0000323 }
public BindingEditorDialog(PluginSettingStore currentBinding = null) { Title = "Binding Editor"; Result = currentBinding; this.Content = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Padding = new Padding(5), Spacing = 5, Items = { new StackLayoutItem { Expand = true, Control = bindingController = new BindingController { Store = currentBinding, Width = 300, Height = 150 } }, new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { new StackLayoutItem { Expand = true, Control = new Button(ClearBinding) { Text = "Clear" } }, new StackLayoutItem { Expand = true, Control = new Button(ApplyBinding) { Text = "Apply" } } } } }, }; }
public void BindingController_ChooseWorkflow_Legacy_UsesOldWorkflow() { // Arrange configProvider.ModeToReturn = SonarLintMode.LegacyConnected; configProvider.ProjectToReturn = ValidProject; // Act var actual = BindingController.CreateBindingProcess(host, ValidBindingArgs); // Assert actual.Should().BeOfType <BindingProcessImpl>(); outputWindowPane.AssertOutputStrings(Strings.Bind_UpdatingLegacyBinding); ((BindingProcessImpl)actual).InternalState.IsFirstBinding.Should().BeFalse(); }
internal List <INavigationListenerComponent> LoadNavigationListeners(AbstractNavigationComponent navigationComponent) { List <INavigationListenerComponent> listeners = new List <INavigationListenerComponent>(); BindablePoint point = navigationComponent.GetBindablePointBySystemName(AbstractUiConstants.IAbstractUiNavigationControl_NavigationListeners_BindingPointName); BindingController bindingController = new BindingController(this.FactoryContext); List <Binding> bindings = bindingController.GetByBindablePointId(point.BindablePointId); foreach (Binding binding in bindings) { INavigationListenerComponent component = this.GetObjectByInstanceId(binding.ImplementationId) as INavigationListenerComponent; listeners.Add(component); } return(listeners); }
public void BindingController_ChooseWorkflow_Legacy_UsesOldWorkflow() { // Arrange configProvider.ModeToReturn = SonarLintMode.LegacyConnected; configProvider.ProjectToReturn = ValidProject; serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), new ConfigurableSourceControlledFileSystem()); // Act var actual = BindingController.CreateBindingWorkflow(host, ValidBindingArgs); // Assert actual.Should().BeOfType <BindingWorkflow>(); outputWindowPane.AssertOutputStrings(Strings.Bind_UpdatingLegacyBinding); ((BindingWorkflow)actual).IsFirstBinding.Should().BeFalse(); }
/// <summary> /// Limpiar los recursos que se estén utilizando. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } //Matias 20100921 - Tarea 849 - Previene MemoryLeak (no se si es necesario pero no está de mas!) _uiController.ValueChanged -= new EventHandler(_uiController_ValueChanged); BindingController.Clear(labelDescription, "Text", _uiController, "Nombre"); //FinMatias 20100921 - Tarea 849 } base.Dispose(disposing); }
public async void Test_ConsecutiveDisableEvents_AreOk() { var config = new SwitchToSensorBinding { SwitchId = SwitchId.NewId(), SensorId = SensorId.NewId() }; IReadOnlyCollection <SwitchToSensorBinding> configCollection = new [] { config }; var bindingsRepoMock = new Mock <ISwitchToSensorBindingsRepository>(MockBehavior.Strict); bindingsRepoMock.Setup(m => m.GetAll()).Returns(Task.FromResult(configCollection)); var handler = new BindingController(Mock.Of <IEventSender>(), bindingsRepoMock.Object); await handler.DisableBinding(config.SwitchId, config.SensorId); await handler.DisableBinding(config.SwitchId, config.SensorId); }
public void BindingController_BindingFinished_Navigation() { // Arrange var bindingArgs = new BindCommandArgs("key2", "", new ConnectionInformation(new Uri("http://myUri"))); BindingController testSubject = this.PrepareCommandForExecution(); var progressEvents = new ConfigurableProgressEvents(); var teController = new ConfigurableTeamExplorerController(); var mefExports = MefTestHelpers.CreateExport <ITeamExplorerController>(teController); var mefModel = ConfigurableComponentModel.CreateWithExports(mefExports); serviceProvider.RegisterService(typeof(SComponentModel), mefModel, replaceExisting: true); // Case 1: On non-successful binding no navigation will occur foreach (ProgressControllerResult nonSuccuess in new[] { ProgressControllerResult.Cancelled, ProgressControllerResult.Failed }) { // Act testSubject.SetBindingInProgress(progressEvents, bindingArgs); progressEvents.SimulateFinished(nonSuccuess); // Assert teController.ShowConnectionsPageCallsCount.Should().Be(0); this.dteMock.ToolWindows.SolutionExplorer.Window.Active.Should().BeFalse(); } // Case 2: Has conflicts (should navigate to team explorer page) this.conflictsController.HasConflicts = true; // Act testSubject.SetBindingInProgress(progressEvents, bindingArgs); progressEvents.SimulateFinished(ProgressControllerResult.Succeeded); // Assert teController.ShowConnectionsPageCallsCount.Should().Be(1); this.dteMock.ToolWindows.SolutionExplorer.Window.Active.Should().BeFalse(); // Case 3: Has no conflicts (should navigate to solution explorer) this.conflictsController.HasConflicts = false; // Act testSubject.SetBindingInProgress(progressEvents, bindingArgs); progressEvents.SimulateFinished(ProgressControllerResult.Succeeded); // Assert teController.ShowConnectionsPageCallsCount.Should().Be(1); this.dteMock.ToolWindows.SolutionExplorer.Window.Active.Should().BeTrue(); }
public void BindingController_BindCommand_OnQueryStatus() { // Arrange BindingController testSubject = this.CreateBindingController(); bool canExecuteChanged = false; testSubject.BindCommand.CanExecuteChanged += (o, e) => canExecuteChanged = true; // Act Guid notUsed = Guid.Empty; ((IOleCommandTarget)testSubject).QueryStatus(ref notUsed, 0, new OLECMD[0], IntPtr.Zero); // Assert canExecuteChanged.Should().BeTrue("The command needs to invalidate the previous CanExecute state using CanExecuteChanged event"); }
public List <IAbstractComponent> LoadChildControls(AbstractContainer container) { List <IAbstractComponent> children = new List <IAbstractComponent>(); BindablePoint point = container.GetBindablePointBySystemName(AbstractUiConstants.IAbstractUiContainer_Controls_BindingPointName); BindingController bindingController = new BindingController(this.FactoryContext); List <Binding> bindings = bindingController.GetByBindablePointId(point.BindablePointId); foreach (Binding binding in bindings) { IAbstractComponent component = this.GetObjectByInstanceId(binding.ImplementationId) as IAbstractComponent; component.ParentComponent = container; children.Add(component); } return(children); }
private BindingController PrepareCommandForExecution() { this.host.TestStateManager.IsConnected = true; BindingController testSubject = this.CreateBindingController(); this.host.SetActiveSection(ConfigurableSectionController.CreateDefault()); this.monitorSelection.SetContext(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid, true); this.monitorSelection.SetContext(VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid, true); ProjectMock project1 = this.solutionMock.AddOrGetProject("project1"); this.projectSystemHelper.Projects = new[] { project1 }; // Sanity testSubject.BindCommand.CanExecute(CreateBindingArguments("project1", "name1", "http://localhost")).Should().BeTrue("All the requirement should be satisfied for the command to be enabled"); return(testSubject); }
public void BindingController_ChooseWorkflow_Connected_UsesNewWorkflow() { // Arrange configProvider.ModeToReturn = SonarLintMode.Connected; configProvider.ProjectToReturn = ValidProject; // Act var actual = BindingController.CreateBindingProcess(host, ValidBindingArgs); // Assert actual.Should().BeOfType <BindingProcessImpl>(); var bindingProcessImpl = (BindingProcessImpl)actual; bindingProcessImpl.NuGetBindingOperation.Should().BeOfType <NoOpNuGetBindingOperation>(); bindingProcessImpl.InternalState.IsFirstBinding.Should().BeFalse(); outputWindowPane.AssertOutputStrings(Strings.Bind_UpdatingNewStyleBinding); }
public void BindingController_ChooseWorkflow_Connected_UsesNewWorkflow() { // Arrange configProvider.ModeToReturn = SonarLintMode.Connected; configProvider.ProjectToReturn = ValidProject; serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), new ConfigurableSourceControlledFileSystem()); // Act var actual = BindingController.CreateBindingWorkflow(host, ValidBindingArgs); // Assert actual.Should().BeOfType <BindingWorkflow>(); var bindingWorkFlow = (BindingWorkflow)actual; bindingWorkFlow.NuGetBindingOperation.Should().BeOfType <NoOpNuGetBindingOperation>(); bindingWorkFlow.IsFirstBinding.Should().BeFalse(); outputWindowPane.AssertOutputStrings(Strings.Bind_UpdatingNewStyleBinding); }
public void BindingController_ChooseWorkflow_Standalone_UsesNewWorkflow() { // Arrange configProvider.ModeToReturn = SonarLintMode.Standalone; configProvider.ProjectToReturn = ValidProject; serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), new ConfigurableSourceControlledFileSystem()); // Act var actual = BindingController.CreateBindingProcess(host, ValidBindingArgs); // Assert actual.Should().BeOfType <BindingProcessImpl>(); var bindingProcessImpl = (BindingProcessImpl)actual; bindingProcessImpl.NuGetBindingOperation.Should().BeOfType <NoOpNuGetBindingOperation>(); outputWindowPane.AssertOutputStrings(Strings.Bind_FirstTimeBinding); bindingProcessImpl.InternalState.IsFirstBinding.Should().BeTrue(); }