Exemplo n.º 1
0
        protected virtual string WriteConstructFrom(IOperationSymbolContainer oper)
        {
            List <Type> type = oper.GetType().GetGenericArguments().ToList();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("new Graph<{0}>.ConstructFrom<{1}>({2})".FormatWith(type[0].TypeName(), type[1].TypeName(), oper.Symbol.ToString()));
            sb.AppendLine("{");
            sb.AppendLine("    Construct = ({0}, _) => new {1}".FormatWith(GetVariableName(type[1]), type[0].TypeName()));
            sb.AppendLine("    {");
            sb.AppendLine("    }");
            sb.AppendLine("}.Register();");
            return(sb.ToString());
        }
Exemplo n.º 2
0
        protected virtual string WriteConstructSimple(IOperationSymbolContainer oper)
        {
            Type type = oper.GetType().GetGenericArguments().Single();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("new Graph<{0}>.Construct({1})".FormatWith(type.TypeName(), oper.Symbol.ToString()));
            sb.AppendLine("{");
            sb.AppendLine("    Construct = (_) => new {0}".FormatWith(type.TypeName()));
            sb.AppendLine("    {");
            sb.AppendLine("    }");
            sb.AppendLine("}.Register();");
            return(sb.ToString());
        }
Exemplo n.º 3
0
        protected virtual string WriteDeleteOperation(IOperationSymbolContainer oper)
        {
            if (ShouldWriteSimpleOperations(oper))
            {
                return(null);
            }

            Type type = oper.GetType().GetGenericArguments().Single();

            string v = GetVariableName(type);

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("new Graph<{0}>.Delete({1})".FormatWith(type.TypeName(), oper.Symbol.ToString()));
            sb.AppendLine("{");
            sb.AppendLine("    Delete = ({0}, _) => {0}.Delete()".FormatWith(v));
            sb.AppendLine("}.Register();");
            return(sb.ToString());
        }
Exemplo n.º 4
0
        protected virtual string WriteExecuteOperation(IOperationSymbolContainer oper)
        {
            Type type = oper.GetType().GetGenericArguments().Single();

            var v = GetVariableName(type);

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("new Graph<{0}>.Execute({1})".FormatWith(type.TypeName(), oper.Symbol.ToString()));
            sb.AppendLine("{");
            if (IsSave(oper))
            {
                sb.AppendLine("    AllowsNew = true,");
                sb.AppendLine("    Lite = false,");
            }
            sb.AppendLine("    Execute = ({0}, _) => {{ }}".FormatWith(v));
            sb.AppendLine("}.Register();");
            return(sb.ToString());
        }
        public void DeleteClick(IOperationSymbolContainer symbolContainer, bool consumeConfirmation = true, bool shouldDisapear = true)
        {
            var lites = ResultTable.SelectedEntities();

            Operation(symbolContainer).WaitVisible().Click();
            if (consumeConfirmation)
            {
                ResultTable.Selenium.ConsumeAlert();
            }

            if (shouldDisapear)
            {
                ResultTable.WaitNoVisible(lites);
            }
            else
            {
                ResultTable.WaitSuccess(lites);
            }
        }
        protected virtual string WriteExecuteOperation(IOperationSymbolContainer oper)
        {   
            Type type = oper.GetType().GetGenericArguments().Single();

            var v = GetVariableName(type);

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("new Graph<{0}>.Execute({1})".FormatWith(type.TypeName(), oper.Symbol.ToString()));
            sb.AppendLine("{");
            if (IsSave(oper))
            {
                sb.AppendLine("    AllowsNew = true,");
                sb.AppendLine("    Lite = false,");
            }
            sb.AppendLine("    Execute = ({0}, _) => {{ }}".FormatWith(v));
            sb.AppendLine("}.Register();");
            return sb.ToString();
        }
Exemplo n.º 7
0
 public OperationSettings(IOperationSymbolContainer symbol)
 {
     this.OperationSymbol = symbol.Operation;
 }
Exemplo n.º 8
0
 protected virtual bool IsSave(IOperationSymbolContainer oper)
 {
     return(oper.ToString().Contains("Save"));;
 }
 public bool OperationIsDisabled(IOperationSymbolContainer symbolContainer)
 {
     return(Operation(symbolContainer).WaitVisible().GetAttribute("disabled").HasText());
 }
Exemplo n.º 10
0
        protected virtual string WriteConstructFromMany(IOperationSymbolContainer oper)
        {
            List<Type> type = oper.GetType().GetGenericArguments().ToList();

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("new Graph<{0}>.ConstructFromMany<{1}>({2})".FormatWith(type[0].TypeName(), type[1].TypeName(), oper.Symbol.ToString()));
            sb.AppendLine("{");
            sb.AppendLine("    Construct = ({0}s, _) => new {1}".FormatWith(GetVariableName(type[1]), type[0].TypeName()));
            sb.AppendLine("    {");
            sb.AppendLine("    }");
            sb.AppendLine("}.Register();");
            return sb.ToString();
        }
Exemplo n.º 11
0
        protected virtual string WriteDeleteOperation(IOperationSymbolContainer oper)
        {
            if (ShouldWriteSimpleOperations(oper))
                return null;

            Type type = oper.GetType().GetGenericArguments().Single();

            string v = GetVariableName(type);

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("new Graph<{0}>.Delete({1})".FormatWith(type.TypeName(), oper.Symbol.ToString()));
            sb.AppendLine("{");
            sb.AppendLine("    Delete = ({0}, _) => {0}.Delete()".FormatWith(v));
            sb.AppendLine("}.Register();");
            return sb.ToString();
        }
Exemplo n.º 12
0
 public PopupControl <ProcessEntity> DeleteProcessClick(IOperationSymbolContainer symbolContainer)
 {
     return(DeleteProcessClick(symbolContainer.Symbol));
 }
Exemplo n.º 13
0
 public void DeleteClick(IOperationSymbolContainer symbolContainer, bool consumeConfirmation = true)
 {
     DeleteClick(symbolContainer.Symbol);
 }
Exemplo n.º 14
0
 public void ExecuteClick(IOperationSymbolContainer symbolContainer, bool consumeConfirmation = false)
 {
     ExecuteClick(symbolContainer.Symbol, consumeConfirmation);
 }
Exemplo n.º 15
0
 public ContextualOperationSettings(IOperationSymbolContainer symbolContainer)
     : base(symbolContainer)
 {
 }
Exemplo n.º 16
0
 public ConstructorSettings(IOperationSymbolContainer symbolContainer)
     : base(symbolContainer)
 {
 }
Exemplo n.º 17
0
 public EntityOperationSettings(IOperationSymbolContainer symbolContainer)
     : base(symbolContainer)
 {
     Contextual = new ContextualOperationSettings(symbolContainer);
     ContextualFromMany = new ContextualOperationSettings(symbolContainer); 
 }
Exemplo n.º 18
0
 private bool ShouldWriteSimpleOperations(IOperationSymbolContainer oper)
 {
     return true;
 }
Exemplo n.º 19
0
 protected virtual bool IsSave(IOperationSymbolContainer oper)
 {
     return oper.ToString().Contains("Save"); ;
 }
Exemplo n.º 20
0
 public bool IsDisabled(IOperationSymbolContainer symbol)
 {
     return(IsDisabled(symbol.Symbol.KeyWeb()));
 }
Exemplo n.º 21
0
        protected virtual string WriteConstructSimple(IOperationSymbolContainer oper)
        {
            Type type = oper.GetType().GetGenericArguments().Single();

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("new Graph<{0}>.Construct({1})".FormatWith(type.TypeName(), oper.Symbol.ToString()));
            sb.AppendLine("{");
            sb.AppendLine("    Construct = (_) => new {0}".FormatWith(type.TypeName()));
            sb.AppendLine("    {");
            sb.AppendLine("    }");
            sb.AppendLine("}.Register();");
            return sb.ToString();
        }
Exemplo n.º 22
0
 public PopupControl <T> MenuClickPopup <T>(IOperationSymbolContainer contanier, string prefix = "New")
     where T : Entity
 {
     return(MenuClickPopup <T>(contanier.Symbol.KeyWeb(), prefix));
 }
 public WebElementLocator Operation(IOperationSymbolContainer symbolContainer)
 {
     return(this.Element.WithLocator(By.CssSelector("a[data-operation=\'{0}']".FormatWith(symbolContainer.Symbol.Key))));
 }
Exemplo n.º 24
0
 public NormalPage <T> MenuClickNormalPage <T>(IOperationSymbolContainer contanier) where T : Entity
 {
     return(MenuClickNormalPage <T>(contanier.Symbol.KeyWeb()));
 }
Exemplo n.º 25
0
    public IWebElement OperationClickCapture(IOperationSymbolContainer symbolContainer)
    {
        var popup = Operation(symbolContainer).WaitVisible().CaptureOnClick();

        return(popup);
    }
Exemplo n.º 26
0
        public static NormalPage <T> OperationNormalPageNew <T>(this IEntityButtonContainer container, IOperationSymbolContainer symbol)
            where T : Entity
        {
            container.ButtonClick(symbol.Symbol.KeyWeb());

            container.Selenium.Wait(() => { try { return(container.RuntimeInfo().IsNew); } catch { return(false); } });

            return(new NormalPage <T>(container.Selenium, null));
        }
Exemplo n.º 27
0
 private bool ShouldWriteSimpleOperations(IOperationSymbolContainer oper)
 {
     return(true);
 }
Exemplo n.º 28
0
        protected virtual string WriteOperation(IOperationSymbolContainer oper)
        {
            string type = oper.GetType().TypeName();

            if (type.Contains("ExecuteSymbolImp"))
                return WriteExecuteOperation((IEntityOperationSymbolContainer)oper);

            if (type.Contains("DeleteSymbolImp"))
                return WriteDeleteOperation((IEntityOperationSymbolContainer)oper);

            if (type.Contains("FromImp"))
                return WriteConstructFrom((IEntityOperationSymbolContainer)oper);

            if (type.Contains("FromManyImp"))
                return WriteConstructFromMany(oper);

            if (type.Contains("SimpleImp"))
                return WriteConstructSimple(oper);

            throw new InvalidOperationException();
        }
Exemplo n.º 29
0
        protected virtual string WriteOperation(IOperationSymbolContainer oper)
        {

            switch (GetOperationType(oper))
            {
                case OperationType.Execute:
                    if (IsSave(oper) && ShouldWriteSimpleOperations(oper))
                        return null;
                    return WriteExecuteOperation(oper);
                case OperationType.Delete:
                    return WriteDeleteOperation(oper);
                case OperationType.Constructor:
                    return WriteConstructSimple(oper);
                case OperationType.ConstructorFrom:
                    return WriteConstructFrom(oper);
                case OperationType.ConstructorFromMany:
                    return WriteConstructFromMany(oper);
                default:
                    throw new InvalidOperationException();
            }
        }
Exemplo n.º 30
0
 public EntityOperationSettings(IOperationSymbolContainer symbol)
     : base(symbol)
 {
     this.Contextual = new ContextualOperationSettings(symbol);
     this.ContextualFromMany = new ContextualOperationSettings(symbol); 
 }
Exemplo n.º 31
0
        public static PopupControl <T> OperationPopup <T>(this IEntityButtonContainer container, IOperationSymbolContainer symbol, string prefix = "New")
            where T : ModifiableEntity
        {
            container.ButtonClick(symbol.Symbol.KeyWeb());

            var popup = new PopupControl <T>(container.Selenium, prefix);

            container.Selenium.WaitElementPresent(popup.PopupLocator);

            return(popup);
        }
Exemplo n.º 32
0
        private OperationType GetOperationType(IOperationSymbolContainer oper)
        {
            string type = oper.GetType().TypeName();

            if (type.Contains("ExecuteSymbolImp"))
                return OperationType.Execute;

            if (type.Contains("DeleteSymbolImp"))
                return OperationType.Delete;

            if (type.Contains("SimpleImp"))
                return OperationType.Constructor;

            if (type.Contains("FromImp"))
                return OperationType.ConstructorFrom;

            if (type.Contains("FromManyImp"))
                return OperationType.ConstructorFromMany;
;
            throw new InvalidOperationException();
        }