Пример #1
0
    internal void AddCommentToCommentAndCheck(ExampleComment comment)
    {
        _driver.FindElement(By.CssSelector("[aria-label*='" + comment.Name + "']")).Click();

        var Replay = _driver.FindElement(By.CssSelector("[id='comment'][name='comment']"));

        WaitForClickable(Replay, 5);
        Replay.Click();
        Replay.SendKeys(comment.ReplayComment);

        var EmailReplay = _driver.FindElement(By.Id("email"));

        EmailReplay.Click();
        EmailReplay.Clear();
        EmailReplay.SendKeys(comment.ReplayEmail);

        var AuthorReplay = _driver.FindElement(By.Id("author"));

        AuthorReplay.Click();
        AuthorReplay.Clear();
        AuthorReplay.SendKeys(comment.ReplayName);

        WaitForClickable(_driver.FindElement(By.Id("comment-submit")), 5);
        _driver.FindElement(By.Id("comment-submit")).Click();

        var CommentBlocks           = _driver.FindElements(By.CssSelector("li[class*='comment']"));
        var CheckReplayAfterComment = CommentBlocks.Where(c => c.FindElement(By.TagName("p")).Text.Contains(comment.Text));

        Assert.Single(CheckReplayAfterComment);
        var ReplayBlocks = CheckReplayAfterComment.First().FindElements(By.CssSelector("ul[class='children']"));
        var OneBlock     = ReplayBlocks.Where(r => r.FindElement(By.TagName("p")).Text.Contains(comment.ReplayComment));

        Assert.Single(OneBlock);
    }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedField"/> class.
 /// </summary>
 /// <param name="info">The field info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 public DocumentedField(
     IFieldInfo info,
     SummaryComment summary, 
     RemarksComment remarks,
     ExampleComment example)
     : base(MemberClassification.Type, summary, remarks, example)
 {
     _definition = info.Definition;
     _identity = info.Identity;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedField"/> class.
 /// </summary>
 /// <param name="info">The field info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 public DocumentedField(
     IFieldInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example)
     : base(MemberClassification.Type, summary, remarks, example)
 {
     _definition = info.Definition;
     _identity   = info.Identity;
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMember"/> class.
 /// </summary>
 /// <param name="classification">The member classification.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 protected DocumentedMember(
     MemberClassification classification, 
     SummaryComment summary, 
     RemarksComment remarks, 
     ExampleComment example)
 {
     _classification = classification;
     _summary = summary;
     _remarks = remarks;
     _example = example;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMember"/> class.
 /// </summary>
 /// <param name="classification">The member classification.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 protected DocumentedMember(
     MemberClassification classification,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example)
 {
     _classification = classification;
     _summary        = summary;
     _remarks        = remarks;
     _example        = example;
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedProperty" /> class.
 /// </summary>
 /// <param name="info">The property info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 /// <param name="value">The value comment.</param>
 public DocumentedProperty(
     IPropertyInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example,
     ValueComment value)
     : base(MemberClassification.Property, summary, remarks, example)
 {
     _definition = info.Definition;
     _identity   = info.Identity;
     _value      = value;
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedProperty" /> class.
 /// </summary>
 /// <param name="info">The property info.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 /// <param name="value">The value comment.</param>
 public DocumentedProperty(
     IPropertyInfo info,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example,
     ValueComment value)
     : base(MemberClassification.Property, summary, remarks, example)
 {
     _definition = info.Definition;
     _identity = info.Identity;
     _value = value;
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 /// <param name="returns">The return value comment.</param>
 public DocumentedMethod(
     IMethodInfo info,
     IEnumerable <DocumentedParameter> parameters,
     SummaryComment summary,
     RemarksComment remarks,
     ExampleComment example,
     ReturnsComment returns) : base(MemberClassification.Method, summary, remarks, example)
 {
     _definition           = info.Definition;
     _methodClassification = info.Definition.GetMethodClassification();
     _identity             = info.Identity;
     _parameters           = new List <DocumentedParameter>(parameters);
     _returns = returns;
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentedMethod" /> class.
 /// </summary>
 /// <param name="info">The method info.</param>
 /// <param name="parameters">The method's parameters.</param>
 /// <param name="summary">The summary comment.</param>
 /// <param name="remarks">The remarks comment.</param>
 /// <param name="example">The example comment.</param>
 /// <param name="returns">The return value comment.</param>
 public DocumentedMethod(
     IMethodInfo info, 
     IEnumerable<DocumentedParameter> parameters,
     SummaryComment summary, 
     RemarksComment remarks, 
     ExampleComment example,
     ReturnsComment returns)
     : base(MemberClassification.Method, summary, remarks, example)
 {
     _definition = info.Definition;
     _methodClassification = MethodClassifier.GetMethodClassification(info.Definition);
     _identity = info.Identity;
     _parameters = new List<DocumentedParameter>(parameters);
     _returns = returns;
 }
Пример #10
0
    internal void AddComment(ExampleComment comment)
    {
        var commentElement = _driver.FindElement(By.Id("comment"));

        commentElement.SendKeys(comment.Text);

        var emailElement = _driver.FindElement(By.Id("email"));

        emailElement.SendKeys(comment.Email);

        var userElement = _driver.FindElement(By.Id("author"));

        userElement.SendKeys(comment.Name);

        var submitElement = _driver.FindElement(By.Id("comment-submit"));

        submitElement.Click();
    }
Пример #11
0
        private static DocumentedType MapType(ITypeInfo type, XmlDocumentationModel xmlModel)
        {
            SummaryComment summary = null;
            RemarksComment remarks = null;
            ExampleComment example = null;

            // Get the documentation for the type.
            var member = xmlModel.Find(type.Identity);

            if (member != null)
            {
                // Get the comments for the type.
                summary = member.Comments.OfType <SummaryComment>().SingleOrDefault();
                remarks = member.Comments.OfType <RemarksComment>().SingleOrDefault();
                example = member.Comments.OfType <ExampleComment>().SingleOrDefault();
            }

            // Map the methods.
            var methods = new List <DocumentedMethod>();

            foreach (var method in type.Methods)
            {
                methods.Add(MapMethod(method, xmlModel));
            }

            // Map the properties.
            var properties = new List <DocumentedProperty>();

            foreach (var property in type.Properties)
            {
                properties.Add(MapProperty(property, xmlModel));
            }

            // Map the fields.
            var fields = new List <DocumentedField>();

            foreach (var field in type.Fields)
            {
                fields.Add(MapField(field, xmlModel));
            }

            // Return the documented type.
            return(new DocumentedType(type, properties, methods, fields, summary, remarks, example));
        }
Пример #12
0
        private static DocumentedField MapField(IFieldInfo field, XmlDocumentationModel xmlModel)
        {
            SummaryComment summary = null;
            RemarksComment remarks = null;
            ExampleComment example = null;

            // Get the documentation for the type.
            var member = xmlModel.Find(field.Identity);

            if (member != null)
            {
                // Get the comments for the type.
                summary = member.Comments.OfType <SummaryComment>().SingleOrDefault();
                remarks = member.Comments.OfType <RemarksComment>().SingleOrDefault();
                example = member.Comments.OfType <ExampleComment>().SingleOrDefault();
            }

            return(new DocumentedField(field, summary, remarks, example));
        }
Пример #13
0
        private static DocumentedProperty MapProperty(IPropertyInfo property, XmlDocumentationModel xmlModel)
        {
            SummaryComment summary = null;
            RemarksComment remarks = null;
            ExampleComment example = null;
            ValueComment   value   = null;

            // Get the documentation for the type.
            var member = xmlModel.Find(property.Identity);

            if (member != null)
            {
                // Get the comments for the type.
                summary = member.Comments.OfType <SummaryComment>().SingleOrDefault();
                remarks = member.Comments.OfType <RemarksComment>().SingleOrDefault();
                example = member.Comments.OfType <ExampleComment>().SingleOrDefault();
                value   = member.Comments.OfType <ValueComment>().SingleOrDefault();
            }

            return(new DocumentedProperty(property, summary, remarks, example, value));
        }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedType" /> class.
        /// </summary>
        /// <param name="info">The type information.</param>
        /// <param name="properties">The type's properties.</param>
        /// <param name="methods">The type's methods.</param>
        /// <param name="fields">The type's fields.</param>
        /// <param name="summary">The summary.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="example">The example.</param>
        public DocumentedType(
            ITypeInfo info,
            IEnumerable <DocumentedProperty> properties,
            IEnumerable <DocumentedMethod> methods,
            IEnumerable <DocumentedField> fields,
            SummaryComment summary,
            RemarksComment remarks,
            ExampleComment example)
            : base(MemberClassification.Type, summary, remarks, example)
        {
            _definition         = info.Definition;
            _typeClassification = info.Definition.GetTypeClassification();
            _identity           = info.Identity;
            _properties         = new List <DocumentedProperty>(properties);
            _fields             = new List <DocumentedField>(fields);

            // Materialize all methods.
            var documentedMethods = methods as DocumentedMethod[] ?? methods.ToArray();

            _constructors = new List <DocumentedMethod>(GetConstructors(documentedMethods));
            _methods      = new List <DocumentedMethod>(GetMethods(documentedMethods));
            _operators    = new List <DocumentedMethod>(GetOperators(documentedMethods));
        }
Пример #15
0
        private static DocumentedMethod MapMethod(IMethodInfo method, XmlDocumentationModel xmlModel)
        {
            var parameters = new List <DocumentedParameter>();

            SummaryComment summary = null;
            RemarksComment remarks = null;
            ExampleComment example = null;
            ReturnsComment returns = null;

            // Get the documentation for the type.
            var member = xmlModel.Find(method.Identity);

            if (member != null)
            {
                // Get the comments for the type.
                summary = member.Comments.OfType <SummaryComment>().FirstOrDefault();
                remarks = member.Comments.OfType <RemarksComment>().FirstOrDefault();
                example = member.Comments.OfType <ExampleComment>().FirstOrDefault();
                returns = member.Comments.OfType <ReturnsComment>().FirstOrDefault();
            }

            // Map parameters.
            foreach (var parameterDefinition in method.Definition.Parameters.ToList())
            {
                ParamComment comment = null;
                if (member != null)
                {
                    // Try to get the comment for the current parameter.
                    comment = member.Comments.OfType <ParamComment>().FirstOrDefault(x => x.Name == parameterDefinition.Name);
                }

                var parameter = new DocumentedParameter(parameterDefinition, comment);
                parameters.Add(parameter);
            }

            return(new DocumentedMethod(method, parameters, summary, remarks, example, returns));
        }
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentedType" /> class.
        /// </summary>
        /// <param name="info">The type information.</param>
        /// <param name="properties">The type's properties.</param>
        /// <param name="methods">The type's methods.</param>
        /// <param name="fields">The type's fields.</param>
        /// <param name="summary">The summary.</param>
        /// <param name="remarks">The remarks.</param>
        /// <param name="example">The example.</param>
        public DocumentedType(
            ITypeInfo info,
            IEnumerable<DocumentedProperty> properties,
            IEnumerable<DocumentedMethod> methods,
            IEnumerable<DocumentedField> fields,
            SummaryComment summary,
            RemarksComment remarks,
            ExampleComment example)
            : base(MemberClassification.Type, summary, remarks, example)
        {
            _definition = info.Definition;
            _typeClassification = info.Definition.GetTypeClassification();
            _identity = info.Identity;
            _properties = new List<DocumentedProperty>(properties);
            _fields = new List<DocumentedField>(fields);

            // Materialize all methods.
            var documentedMethods = methods as DocumentedMethod[] ?? methods.ToArray();

            _constructors = new List<DocumentedMethod>(GetConstructors(documentedMethods));
            _methods = new List<DocumentedMethod>(GetMethods(documentedMethods));
            _extensionMethods = new List<DocumentedMethod>();
            _operators = new List<DocumentedMethod>(GetOperators(documentedMethods));
        }
Пример #17
0
 public override void VisitExample(ExampleComment comment, StringBuilder context)
 {
     context.Append("<example>");
     base.VisitExample(comment, context);
     context.Append("</example>");
 }
Пример #18
0
    internal IEnumerable <IWebElement> SearchCommentsByText(ExampleComment comment)
    {
        var comments = _driver.FindElements(By.ClassName("comment-content"));

        return(comments.Where(c => c.Text.Contains(comment.Text)));
    }
Пример #19
0
 public override void VisitExample(ExampleComment comment, CommentRendererContext context)
 {
     base.VisitExample(comment, context);
 }
Пример #20
0
 /// <summary>
 /// Visits a <c>example</c> comment.
 /// </summary>
 /// <param name="comment">The comment.</param>
 /// <param name="context">The context.</param>
 /// <returns>The same comment or a new one if it should be replaced.</returns>
 public virtual void VisitExample(ExampleComment comment, TContext context)
 {
     VisitChildren(comment, context);
 }