Beispiel #1
0
        private ClassDeclarationSyntax GetClassForConstLocatorInInfo(WebLocatorInfo locatorInfo)
        {
            var infoMembers     = new List <MemberDeclarationSyntax>();
            var infoMembersList = new List <(string type, string fName, ExpressionSyntax expr)>
            {
                (nameof(WebLocatorType), nameof(locatorInfo.LocatorType), GetESForValue(locatorInfo.LocatorType)),
                ("string", nameof(locatorInfo.LocatorValue), GetESForValue(locatorInfo.LocatorValue)),
                ("bool", nameof(locatorInfo.IsRelative), GetESForValue(locatorInfo.IsRelative))
            };

            foreach (var infoMemberItem in infoMembersList)
            {
                var fd = SF.FieldDeclaration(
                    SF.VariableDeclaration(SF.ParseTypeName(infoMemberItem.type))
                    .AddVariables(SF.VariableDeclarator(SF.Identifier(infoMemberItem.fName))
                                  .WithInitializer(SF.EqualsValueClause(infoMemberItem.expr))
                                  )
                    )
                         .AddModifiers(SF.Token(SyntaxKind.PublicKeyword), SF.Token(SyntaxKind.ConstKeyword));
                infoMembers.Add(fd);
            }



            var infoCD = SF.ClassDeclaration(LocatorStaticClassName)
                         .AddModifiers(SF.Token(SyntaxKind.PublicKeyword), SF.Token(SyntaxKind.StaticKeyword))
                         .AddMembers(infoMembers.ToArray());

            return(infoCD);
        }
Beispiel #2
0
        private ClassDeclarationSyntax GetClassForLocatorInInfo(WebLocatorInfo locatorInfo)
        {
            var infoMembers     = new List <MemberDeclarationSyntax>();
            var infoMembersList = new List <(string type, string fName, string value)>
            {
                (nameof(WebLocatorType), nameof(locatorInfo.LocatorType), $"{nameof(WebLocatorType)}.{locatorInfo.LocatorType}"),
                ("string", nameof(locatorInfo.LocatorValue), locatorInfo.LocatorValue),
                ("bool", nameof(locatorInfo.IsRelative), $"{locatorInfo.IsRelative}"),
            };

            foreach (var infoMemberItem in infoMembersList)
            {
                var docComment = GetDocCommentWithText(infoMemberItem.value);

                var fd = SF.FieldDeclaration(
                    SF.VariableDeclaration(SF.ParseTypeName(infoMemberItem.type))
                    .AddVariables(SF.VariableDeclarator(SF.Identifier(infoMemberItem.fName))
                                  )
                    )
                         .AddModifiers(
                    SF.Token(SF.TriviaList(), SyntaxKind.PublicKeyword, SF.TriviaList())
                    .WithLeadingTrivia(SF.Trivia(docComment))
                    );
                infoMembers.Add(fd);
            }

            var infoCD = SF.ClassDeclaration(LocatorClassName)
                         .AddModifiers(SF.Token(SyntaxKind.PublicKeyword))
                         .AddMembers(infoMembers.ToArray());

            return(infoCD);
        }
Beispiel #3
0
 ///<summary>
 /// Input for Email
 ///</summary>
 public _Email_Input()
 {
     Info = new _Info.Info();
     Locator              = new WebLocatorInfo();
     Locator.LocatorType  = _Info._Locator.LocatorType;
     Locator.LocatorValue = _Info._Locator.LocatorValue;
     Locator.IsRelative   = _Info._Locator.IsRelative;
 }
Beispiel #4
0
 ///<summary>
 /// Form to do login
 ///</summary>
 public _Login_Form()
 {
     Info                 = new _Info.Info();
     Locator              = new WebLocatorInfo();
     Locator.LocatorType  = _Info._Locator.LocatorType;
     Locator.LocatorValue = _Info._Locator.LocatorValue;
     Locator.IsRelative   = _Info._Locator.IsRelative;
     Elements             = new List <WebElementInfo>();
     Email_Input          = new _Email_Input();
     Email_Input.Parent   = this;
     Elements.Add(Email_Input);
 }
        public WebLocatorInfoViewModel(WebLocatorInfo locatorInfo = null)
        {
            this.WhenAnyValue(w => w.LocatorType)
            .Subscribe(t => Value = $"{IsRelative} | {t}: {LocatorValue}");
            this.WhenAnyValue(w => w.LocatorValue)
            .Subscribe(v => Value = $"{IsRelative} | {LocatorType}: {v}");
            this.WhenAnyValue(w => w.IsRelative)
            .Subscribe(ir => Value = $"{ir} | {LocatorType}: {LocatorValue}");

            _sourceLocatorInfo = locatorInfo ?? new WebLocatorInfo();
            LocatorType        = _sourceLocatorInfo.LocatorType;
            LocatorValue       = _sourceLocatorInfo.LocatorValue;
            IsRelative         = _sourceLocatorInfo.IsRelative;
        }
        public static WebLocatorInfoViewModel CreateLocatorModel(WebLocatorInfo webLocatorInfo)
        {
            WebLocatorInfoViewModel model = null;

            if (webLocatorInfo is FrameWebLocatorInfo fli)
            {
                model = new FrameWebLocatorInfoViewModel(webLocatorInfo)
                {
                    FrameLocatorType = fli.FrameLocatorType
                };
            }
            else
            {
                model = new WebLocatorInfoViewModel(webLocatorInfo);
            }

            return(model);
        }
 public FrameWebLocatorInfoViewModel(WebLocatorInfo locatorInfo = null)
     : base(locatorInfo ?? new FrameWebLocatorInfo())
 {
     this.WhenAnyValue(w => w.FrameLocatorType)
     .Subscribe(t => Value = $"{t} > {IsRelative} | {LocatorType}: {LocatorValue}");
 }