Exemplo n.º 1
0
    public static void Delete <T>(this FrameModalProxy <T> container, DeleteSymbol <T> symbol, bool consumeAlert = true)
        where T : Entity
    {
        container.OperationClick(symbol);
        if (consumeAlert)
        {
            container.Selenium.CloseMessageModal(MessageModalButton.Yes);
        }

        container.WaitNotVisible();
    }
Exemplo n.º 2
0
        public void OrderWebTestExample()
        {
            Browse("Normal", b =>
            {
                Lite <OrderEntity>?lite = null;
                try
                {
                    b.SearchPage(typeof(PersonEntity)).Using(persons =>
                    {
                        persons.Search();
                        persons.SearchControl.Results.OrderBy("Id");
                        return(persons.Results.EntityClick <PersonEntity>(1));
                    }).Using(john =>
                    {
                        using (FrameModalProxy <OrderEntity> order = john.ConstructFrom(OrderOperation.CreateOrderFromCustomer))
                        {
                            order.ValueLineValue(a => a.ShipName, Guid.NewGuid().ToString());
                            order.EntityCombo(a => a.ShipVia).SelectLabel("FedEx");

                            ProductEntity sonicProduct = Database.Query <ProductEntity>().SingleEx(p => p.ProductName.Contains("Sonic"));

                            var line = order.EntityDetail(a => a.Details).GetOrCreateDetailControl <OrderDetailEmbedded>();
                            line.EntityLineValue(a => a.Product, sonicProduct.ToLite());

                            Assert.Equal(sonicProduct.UnitPrice, order.ValueLineValue(a => a.TotalPrice));

                            order.Execute(OrderOperation.Save);

                            lite = order.GetLite();

                            Assert.Equal(sonicProduct.UnitPrice, order.ValueLineValue(a => a.TotalPrice));
                        }

                        return(b.NormalPage(lite));
                    }).EndUsing(order =>
                    {
                        Assert.Equal(lite.InDB(a => a.TotalPrice), order.ValueLineValue(a => a.TotalPrice));
                    });
                }
                finally
                {
                    if (lite != null)
                    {
                        lite.Delete();
                    }
                }
            });
        }//OrderReactTestExample
    public FrameModalProxy <T> ConstructFrom <F, T>(ConstructSymbol <T> .From <F> constructSymbol, bool shouldDisapear = false)
        where F : Entity
        where T : Entity
    {
        var lites = ResultTable.SelectedEntities();

        var modal = Operation(constructSymbol).WaitVisible().CaptureOnClick();

        var result = new FrameModalProxy <T>(modal);

        result.Disposing += okPressed =>
        {
            if (shouldDisapear)
            {
                ResultTable.WaitNoVisible(lites);
            }
            else
            {
                ResultTable.WaitSuccess(lites);
            }
        };

        return(result);
    }