Esempio n. 1
0
        public void Check_add_from_catalog_enabling()
        {
            user.IsStockEnabled = true;
            session.Save(user);
            var waybill = new Waybill(address, session.Query <Supplier>().First());

            waybill.IsCreatedByUser = true;
            var line = new WaybillLine(waybill)
            {
                Quantity = 1
            };

            waybill.Lines.Add(line);
            session.Save(waybill);

            WpfTestHelper.WithWindow2(async w => {
                var model = new WaybillDetails(waybill.Id);
                var view  = (WaybillDetailsView)Bind(model);
                w.Content = view;

                await view.WaitLoaded();
                var addButton = view.Descendants <Button>().First(b => b.Name == "AddFromCatalog");
                Assert.IsTrue(addButton.Visibility == Visibility.Visible);
                Assert.IsTrue(addButton.IsEnabled);

                view.Descendants <Button>().First(b => b.Name == "Stock")
                .RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                Assert.IsTrue(addButton.Visibility == Visibility.Visible);
                Assert.IsFalse(addButton.IsEnabled);
            });
            WpfTestHelper.CleanSafeError();
        }
Esempio n. 2
0
        public void Auto_edit()
        {
            var waybill = Fixture <LocalWaybill>().Waybill;

            WpfTestHelper.WithWindow2(async w => {
                var model = new WaybillDetails(waybill.Id);
                var view  = (WaybillDetailsView)Bind(model);
                w.Content = view;

                var grid = view.Descendants <DataGrid>().First(g => g.Name == "Lines");
                await grid.WaitLoaded();
                Assert.IsNotNull(grid.CellStyle);

                grid.SelectedItem = waybill.Lines[0];
                grid.RaiseEvent(WpfTestHelper.TextArgs("1"));
                var column = grid.Columns.First(c => c.Header is TextBlock && ((TextBlock)c.Header).Text.Equals("Розничная наценка"));
                var cell   = DataGridHelper.GetCell(
                    (DataGridRow)grid.ItemContainerGenerator.ContainerFromItem(grid.CurrentCell.Item),
                    column,
                    grid.Columns);
                Assert.IsTrue(cell.IsEditing);
                Assert.AreEqual("1", ((TextBox)cell.Content).Text);
            });

            WpfTestHelper.CleanSafeError();
        }
Esempio n. 3
0
        public void Show_print_for_created_waybill()
        {
            var waybill = new Waybill(session.Query <Address>().First(), session.Query <Supplier>().First());

            waybill.IsCreatedByUser = true;
            session.Save(waybill);

            WpfTestHelper.WithWindow2(async w => {
                var model = new WaybillDetails(waybill.Id);
                var view  = (WaybillDetailsView)Bind(model);
                w.Content = view;

                await view.WaitLoaded();
                view.Descendants <Button>().First(b => b.Name == "PrintWaybill")
                .RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
            });
            WpfTestHelper.CleanSafeError();
        }