private async Task OpenAndReturnOnSearch(CatalogNameViewModel viewModel, string term) { var offers = await OpenOffers(viewModel); Input((FrameworkElement)offers.GetView(), "Offers", term); await ViewLoaded <CatalogViewModel>(); }
public void Can_export() { user.Permissions.Clear(); var mode = new CatalogNameViewModel(new CatalogViewModel()); Assert.IsFalse(mode.CanExport); }
public void Set_catalog() { var mode = new CatalogNameViewModel(new CatalogViewModel()); mode.CurrentCatalog = new Catalog("тест"); mode.CurrentCatalogName.Value = null; mode.CurrentCatalog = null; }
public void Recalc_can_export() { user.Permissions.Add(new Permission("FPCF")); var model = new CatalogNameViewModel(new CatalogViewModel()); Activate(model); Assert.IsFalse(model.CanExport); model.ActivateCatalog(); Assert.IsTrue(model.CanExport); }
private async Task <CatalogOfferViewModel> OpenOffers(CatalogNameViewModel viewModel, Catalog catalog = null) { var view = (FrameworkElement)viewModel.GetView(); if (view == null) { throw new Exception($"Не удалось получить view из {viewModel.GetType()}"); } if (catalog != null) { dispatcher.Invoke(() => { var names = activeWindow.Descendants <DataGrid>().First(g => g.Name == "CatalogNames"); names.SelectedItem = names.ItemsSource.Cast <CatalogName>().First(c => c.Id == catalog.Name.Id); }); } WaitIdle(); Input(view, "CatalogNames", Key.Enter); Assert.That(viewModel.Catalogs.Value.Count, Is.GreaterThan(0), "нет ни одной формы выпуска, для {0}", viewModel.CurrentCatalogName.Value); if (viewModel.Catalogs.Value.Count > 1) { if (catalog != null) { dispatcher.Invoke(() => { var catalogs = activeWindow.Descendants <DataGrid>().First(g => g.Name == "Catalogs"); catalogs.SelectedItem = catalogs.ItemsSource.Cast <Catalog>().First(c => c.Id == catalog.Id); }); } Input(view, "Catalogs", Key.Enter); } var offers = (CatalogOfferViewModel)shell.ActiveItem; await ViewLoaded(offers); WaitIdle(); return(offers); }
public void Setup() { catalogModel = Open(new CatalogViewModel()); nameViewModel = (CatalogNameViewModel)catalogModel.ActiveItem; scheduler.Start(); }