private void QuickProfilePanel_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (!(DataContext is QuickProfilePanelViewModel viewModel)) { return; } QuickProfilePanelViewModel = viewModel; Initialize(); }
public void quick_profile_requested_command_no_path() { var subFileSystem = Substitute.For <IFileSystem>(); subFileSystem.ChooseHotasProfileForQuickLoad().Returns(""); var panelVm = new QuickProfilePanelViewModel(Substitute.For <IEventAggregator>(), subFileSystem); panelVm.QuickProfileRequestedCommand.Execute(1); subFileSystem.DidNotReceive().FileOpen(default);
public void setup_quick_profiles() { var subFileSystem = Substitute.For <IFileSystem>(); var list = new Dictionary <int, QuickProfileItem> { { 1, new QuickProfileItem() { AutoLoad = true, Path = "test path" } } }; subFileSystem.LoadQuickProfilesList(Arg.Any <string>()).Returns(list); var panelVm = new QuickProfilePanelViewModel(Substitute.For <IEventAggregator>(), subFileSystem); Assert.Empty(panelVm.QuickProfilesList); panelVm.SetupQuickProfiles(); Assert.Single(panelVm.QuickProfilesList); Assert.True(panelVm.QuickProfilesList[1].AutoLoad); Assert.Equal("test path", panelVm.QuickProfilesList[1].Path); }
public void addicted_to_code_coverage() { var _ = new QuickProfilePanelViewModel(); }