• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AnalyzeCSharp类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AnalyzeCSharp的典型用法代码示例。如果您正苦于以下问题:C# AnalyzeCSharp类的具体用法?C# AnalyzeCSharp怎么用?C# AnalyzeCSharp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AnalyzeCSharp类属于命名空间,在下文中一共展示了AnalyzeCSharp类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TopLevelNamespaceContainsDirectlyNestedNamespaces

            public void TopLevelNamespaceContainsDirectlyNestedNamespaces()
            {
                // Given
                string code = @"
                    namespace Foo
                    {
                    }

                    namespace Foo.Baz
                    {
                    }

                    namespace Bar
                    {
                    }
                ";
                IDocument document = GetDocument(code);
                IExecutionContext context = GetContext();
                IModule module = new AnalyzeCSharp();

                // When
                List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                CollectionAssert.AreEquivalent(new[] { string.Empty, "Foo", "Baz", "Bar" }, results.Select(x => x["Name"]));
                CollectionAssert.AreEquivalent(new [] { "Foo", "Bar" }, 
                    results.Single(x => x["Name"].Equals(string.Empty)).Get<IEnumerable<IDocument>>("MemberNamespaces").Select(x => x["Name"]));
            }
开发者ID:ibebbs,项目名称:Wyam,代码行数:28,代码来源:AnalyzeCSharpNamespacesTests.cs


示例2: TopLevelNamespaceContainsDirectlyNestedNamespaces

        public void TopLevelNamespaceContainsDirectlyNestedNamespaces()
        {
            // Given
            string code = @"
                namespace Foo
                {
                }

                namespace Foo.Baz
                {
                }

                namespace Bar
                {
                }
            ";
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
            IDocument document = Substitute.For<IDocument>();
            document.GetStream().Returns(stream);
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.InputFolder.Returns(Environment.CurrentDirectory);
            context.GetNewDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<MetadataItem>>())
                .Returns(x => new TestDocument((IEnumerable<MetadataItem>)x[2]));
            IModule module = new AnalyzeCSharp();

            // When
            List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            CollectionAssert.AreEquivalent(new[] { string.Empty, "Foo", "Baz", "Bar" }, results.Select(x => x["Name"]));
            CollectionAssert.AreEquivalent(new [] { "Foo", "Bar" }, 
                results.Single(x => x["Name"].Equals(string.Empty)).Get<IEnumerable<IDocument>>("MemberNamespaces").Select(x => x["Name"]));
            stream.Dispose();
        }
开发者ID:martinvobr,项目名称:Wyam,代码行数:34,代码来源:AnalyzeCSharpNamespacesFixture.cs


示例3: ImplicitMemberAccessibility

        public void ImplicitMemberAccessibility()
        {
            // Given
            string code = @"
                namespace Foo
                {
                    class Green
                    {
                        void Blue()
                        {
                        }
                    }
                }
            ";
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
            IDocument document = Substitute.For<IDocument>();
            document.GetStream().Returns(stream);
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.InputFolder.Returns(TestContext.CurrentContext.TestDirectory);
            context.GetNewDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<MetadataItem>>())
                .Returns(x => new TestDocument((IEnumerable<MetadataItem>)x[2]));
            IModule module = new AnalyzeCSharp();

            // When
            List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            Assert.AreEqual(@"private void Blue()", GetMember(results, "Green", "Blue")["Syntax"]);
            stream.Dispose();
        }
开发者ID:Chandu,项目名称:Wyam,代码行数:30,代码来源:AnalyzeCSharpSyntaxFixture.cs


示例4: ClassMembersContainsMethods

            public void ClassMembersContainsMethods()
            {
                // Given
                string code = @"
                    namespace Foo
                    {
                        public class Blue
                        {
                            void Green()
                            {
                            }

                            void Red()
                            {
                            }
                        }
                    }
                ";
                IDocument document = GetDocument(code);
                IExecutionContext context = GetContext();
                IModule module = new AnalyzeCSharp();

                // When
                List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                CollectionAssert.AreEquivalent(new[] { "Green", "Red" }, 
                    GetResult(results, "Blue").Get<IReadOnlyList<IDocument>>("Members").Select(x => x["Name"]));
            }
开发者ID:ibebbs,项目名称:Wyam,代码行数:29,代码来源:AnalyzeCSharpMethodsTests.cs


示例5: MultiLineSummary

            public void MultiLineSummary()
            {
                // Given
                string code = @"
                    namespace Foo
                    {
                        /// <summary>
                        /// This is a summary.
                        /// </summary>
                        class Green
                        {
                        }

                        /// <summary>
                        /// This is
                        /// another summary.
                        /// </summary>
                        struct Red
                        {
                        }
                    }
                ";
                IDocument document = GetDocument(code);
                IExecutionContext context = GetContext();
                IModule module = new AnalyzeCSharp();

                // When
                List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                Assert.AreEqual("\n    This is a summary.\n    ", GetResult(results, "Green")["Summary"]);
                Assert.AreEqual("\n    This is\n    another summary.\n    ", GetResult(results, "Red")["Summary"]);
            }
开发者ID:ibebbs,项目名称:Wyam,代码行数:33,代码来源:AnalyzeCSharpXmlDocumentationTests.cs


示例6: AutoProperty

        public void AutoProperty()
        {
            // Given
            string code = @"
                namespace Foo
                {
                    class Green
                    {
                        public int Blue { get; set; }
                    }
                }
            ";
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
            IDocument document = Substitute.For<IDocument>();
            document.GetStream().Returns(stream);
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.GetNewDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<KeyValuePair<string, object>>>())
                .Returns(x => new TestDocument((IEnumerable<KeyValuePair<string, object>>)x[2]));
            IModule module = new AnalyzeCSharp();

            // When
            List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            Assert.AreEqual(@"public int Blue { get; set; }", GetMember(results, "Green", "Blue")["Syntax"]);
            stream.Dispose();
        }
开发者ID:st1pps,项目名称:Wyam,代码行数:27,代码来源:AnalyzeCSharpSyntaxFixture.cs


示例7: AbstractClass

            public void AbstractClass()
            {
                // Given
                string code = @"
                    namespace Foo
                    {
                        abstract class Green
                        {
                        }
                    }
                ";
                MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
                IDocument document = Substitute.For<IDocument>();
                document.GetStream().Returns(stream);
                IExecutionContext context = Substitute.For<IExecutionContext>();
                context.InputFolder.Returns(TestContext.CurrentContext.TestDirectory);
                context.GetDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<KeyValuePair<string, object>>>())
                    .Returns(x => new TestDocument((IEnumerable<MetadataItem>)x[2]));
                IModule module = new AnalyzeCSharp();

                // When
                List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                Assert.AreEqual(@"internal abstract class Green", GetResult(results, "Green")["Syntax"]);
                stream.Dispose();
            }
开发者ID:ryanrousseau,项目名称:Wyam,代码行数:27,代码来源:AnalyzeCSharpSyntaxTests.cs


示例8: ExceptionElementWithoutCref

            public void ExceptionElementWithoutCref()
            {
                // Given
                string code = @"
                    namespace Foo
                    {
                        class Green
                        {
                            /// <exception>Throws when null</exception>
                            void Go()
                            {
                            }
                        }
                    }
                ";
                MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
                IDocument document = Substitute.For<IDocument>();
                document.GetStream().Returns(stream);
                IExecutionContext context = Substitute.For<IExecutionContext>();
                context.InputFolder.Returns(TestContext.CurrentContext.TestDirectory);
                context.GetDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<KeyValuePair<string, object>>>())
                    .Returns(x => new TestDocument((IEnumerable<MetadataItem>)x[2]));
                IModule module = new AnalyzeCSharp();

                // When
                List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                Assert.AreEqual(string.Empty,
                    GetMember(results, "Green", "Go").List<ReferenceComment>("Exceptions")[0].Name);
                Assert.AreEqual("Throws when null",
                    GetMember(results, "Green", "Go").List<ReferenceComment>("Exceptions")[0].Html);
                stream.Dispose();
            }
开发者ID:ryanrousseau,项目名称:Wyam,代码行数:34,代码来源:AnalyzeCSharpXmlDocumentationTests.cs


示例9: ClassMembersContainsMethods

        public void ClassMembersContainsMethods()
        {
            // Given
            string code = @"
                namespace Foo
                {
                    public class Blue
                    {
                        void Green()
                        {
                        }

                        void Red()
                        {
                        }
                    }
                }
            ";
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
            IDocument document = Substitute.For<IDocument>();
            document.GetStream().Returns(stream);
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.InputFolder.Returns(TestContext.CurrentContext.TestDirectory);
            context.GetNewDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<MetadataItem>>())
                .Returns(x => new TestDocument((IEnumerable<MetadataItem>)x[2]));
            IModule module = new AnalyzeCSharp();

            // When
            List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            CollectionAssert.AreEquivalent(new[] { "Green", "Red" }, 
                GetResult(results, "Blue").Get<IReadOnlyList<IDocument>>("Members").Select(x => x["Name"]));
            stream.Dispose();
        }
开发者ID:Chandu,项目名称:Wyam,代码行数:35,代码来源:AnalyzeCSharpMethodsFixture.cs


示例10: SingleLineSummary

        public void SingleLineSummary()
        {
            // Given
            string code = @"
                namespace Foo
                {
                    /// <summary>This is a summary.</summary>
                    class Green
                    {
                    }

                    /// <summary>This is another summary.</summary>
                    struct Red
                    {
                    }
                }
            ";
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
            IDocument document = Substitute.For<IDocument>();
            document.GetStream().Returns(stream);
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.InputFolder.Returns(Environment.CurrentDirectory);
            context.GetNewDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<MetadataItem>>())
                .Returns(x => new TestDocument((IEnumerable<MetadataItem>)x[2]));
            IModule module = new AnalyzeCSharp();

            // When
            List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            Assert.AreEqual("This is a summary.", GetResult(results, "Green")["Summary"]);
            Assert.AreEqual("This is another summary.", GetResult(results, "Red")["Summary"]);
            stream.Dispose();
        }
开发者ID:martinvobr,项目名称:Wyam,代码行数:34,代码来源:AnalyzeCSharpXmlDocumentationFixture.cs


示例11: ContainingTypeIsCorrect

        public void ContainingTypeIsCorrect()
        {
            // Given
            string code = @"
                namespace Foo
                {
                    public class Blue
                    {
                        void Green()
                        {
                        }
                    }
                }
            ";
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
            IDocument document = Substitute.For<IDocument>();
            document.GetStream().Returns(stream);
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.InputFolder.Returns(Environment.CurrentDirectory);
            context.GetNewDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<MetadataItem>>())
                .Returns(x => new TestDocument((IEnumerable<MetadataItem>)x[2]));
            IModule module = new AnalyzeCSharp();

            // When
            List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            Assert.AreEqual("Blue", GetMember(results, "Blue", "Green").Get<IDocument>("ContainingType")["Name"]);
            stream.Dispose();
        }
开发者ID:martinvobr,项目名称:Wyam,代码行数:30,代码来源:AnalyzeCSharpMethodsFixture.cs


示例12: FullNameDoesNotContainFullHierarchy

        public void FullNameDoesNotContainFullHierarchy()
        {
            // Given
            string code = @"
                namespace Foo
                {
                }

                namespace Foo.Bar
                {
                }
            ";
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
            IDocument document = Substitute.For<IDocument>();
            document.GetStream().Returns(stream);
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.GetNewDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<KeyValuePair<string, object>>>())
                .Returns(x => new TestDocument((IEnumerable<KeyValuePair<string, object>>)x[2]));
            IModule module = new AnalyzeCSharp();

            // When
            List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            CollectionAssert.AreEquivalent(new[] { string.Empty, "Foo", "Bar" }, results.Select(x => x["FullName"]));
            stream.Dispose();
        }
开发者ID:st1pps,项目名称:Wyam,代码行数:27,代码来源:AnalyzeCSharpNamespacesFixture.cs


示例13: BaseTypeIsCorrect

            public void BaseTypeIsCorrect()
            {
                // Given
                string code = @"
                    namespace Foo
                    {
                        public class Red
                        {
                        }

                        public class Green : Red
                        {
                        }

                        struct Blue
                        {
                        }

                        interface Yellow
                        {
                        }

                        interface Purple : Yellow
                        {
                        }

                        enum Orange
                        {
                        }
                    }
                ";
                MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
                IDocument document = Substitute.For<IDocument>();
                document.GetStream().Returns(stream);
                IExecutionContext context = Substitute.For<IExecutionContext>();
                context.InputFolder.Returns(TestContext.CurrentContext.TestDirectory);
                context.GetDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<KeyValuePair<string, object>>>())
                    .Returns(x => new TestDocument((IEnumerable<MetadataItem>)x[2]));
                IModule module = new AnalyzeCSharp();

                // When
                List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                Assert.AreEqual("Object", results.Single(x => x["Name"].Equals("Red")).Get<IDocument>("BaseType")["Name"]);
                Assert.AreEqual("Red", results.Single(x => x["Name"].Equals("Green")).Get<IDocument>("BaseType")["Name"]);
                Assert.AreEqual("ValueType", results.Single(x => x["Name"].Equals("Blue")).Get<IDocument>("BaseType")["Name"]);
                Assert.IsNull(results.Single(x => x["Name"].Equals("Yellow")).Get<IDocument>("BaseType"));
                Assert.IsNull(results.Single(x => x["Name"].Equals("Purple")).Get<IDocument>("BaseType"));
                Assert.AreEqual("Enum", results.Single(x => x["Name"].Equals("Orange")).Get<IDocument>("BaseType")["Name"]);
                stream.Dispose();
            }
开发者ID:ryanrousseau,项目名称:Wyam,代码行数:52,代码来源:AnalyzeCSharpTypesTests.cs


示例14: ReturnsAllTypes

        public void ReturnsAllTypes()
        {
            // Given
            string code = @"
                namespace Foo
                {
                    public class Blue
                    {
                    }

                    class Green
                    {
                        class Red
                        {
                        }
                    }

                    internal struct Yellow
                    {
                    }

                    enum Orange
                    {
                    }
                }
            ";
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
            IDocument document = Substitute.For<IDocument>();
            document.GetStream().Returns(stream);
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.InputFolder.Returns(TestContext.CurrentContext.TestDirectory);
            context.GetNewDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<MetadataItem>>())
                .Returns(x => new TestDocument((IEnumerable<MetadataItem>)x[2]));
            IModule module = new AnalyzeCSharp();

            // When
            List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            CollectionAssert.AreEquivalent(new[] { string.Empty, "Foo", "Blue", "Green", "Red", "Yellow", "Orange" }, results.Select(x => x["Name"]));
            stream.Dispose();
        }
开发者ID:Chandu,项目名称:Wyam,代码行数:42,代码来源:AnalyzeCSharpTypesFixture.cs


示例15: ImplicitClassAccessibility

            public void ImplicitClassAccessibility()
            {
                // Given
                string code = @"
                    namespace Foo
                    {
                        class Green
                        {
                        }
                    }
                ";
                IDocument document = GetDocument(code);
                IExecutionContext context = GetContext();
                IModule module = new AnalyzeCSharp();

                // When
                List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                Assert.AreEqual(@"internal class Green", GetResult(results, "Green")["Syntax"]);
            }
开发者ID:ibebbs,项目名称:Wyam,代码行数:21,代码来源:AnalyzeCSharpSyntaxTests.cs


示例16: GetsTopLevelNamespaces

            public void GetsTopLevelNamespaces()
            {
                // Given
                string code = @"
                    namespace Foo
                    {
                    }

                    namespace Bar
                    {
                    }
                ";
                IDocument document = GetDocument(code);
                IExecutionContext context = GetContext();
                IModule module = new AnalyzeCSharp();

                // When
                List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                CollectionAssert.AreEquivalent(new [] { string.Empty, "Foo", "Bar" }, results.Select(x => x["Name"]));
            }
开发者ID:ibebbs,项目名称:Wyam,代码行数:22,代码来源:AnalyzeCSharpNamespacesTests.cs


示例17: MethodWithExceptionElement

        public void MethodWithExceptionElement()
        {
            // Given
            string code = @"
                namespace Foo
                {
                    class Green
                    {
                        /// <exception cref=""FooException"">Throws when null</exception>
                        void Go()
                        {
                        }
                    }

                    class FooException : Exception
                    {
                    }
                }
            ";
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
            IDocument document = Substitute.For<IDocument>();
            document.GetStream().Returns(stream);
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.GetNewDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<KeyValuePair<string, object>>>())
                .Returns(x => new TestDocument((IEnumerable<KeyValuePair<string, object>>)x[2]));
            IModule module = new AnalyzeCSharp();

            // When
            List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            Assert.AreEqual("<a href=\"/Foo/6412642C\">FooException</a>",
                GetMember(results, "Green", "Go").Get<IReadOnlyList<KeyValuePair<string, string>>>("ExceptionHtml")[0].Key);
            Assert.AreEqual("Throws when null",
                GetMember(results, "Green", "Go").Get<IReadOnlyList<KeyValuePair<string, string>>>("ExceptionHtml")[0].Value);
            stream.Dispose();
        }
开发者ID:st1pps,项目名称:Wyam,代码行数:37,代码来源:AnalyzeCSharpXmlDocumentationFixture.cs


示例18: ClassMemberExcludedByPredicate

        public void ClassMemberExcludedByPredicate()
        {
            // Given
            string code = @"
                namespace Foo
                {
                    public class Blue
                    {
                        void Green()
                        {
                        }

                        void Red()
                        {
                        }
                    }
                }
            ";
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(code));
            IDocument document = Substitute.For<IDocument>();
            document.GetStream().Returns(stream);
            IExecutionContext context = Substitute.For<IExecutionContext>();
            context.GetNewDocument(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<IEnumerable<KeyValuePair<string, object>>>())
                .Returns(x => new TestDocument((IEnumerable<KeyValuePair<string, object>>)x[2]));
            IModule module = new AnalyzeCSharp().WhereSymbol(x => x.Name != "Green");

            // When
            List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

            // Then
            CollectionAssert.AreEquivalent(new[] { string.Empty, "Foo", "Blue", "Red" }, results.Select(x => x["Name"]));
            CollectionAssert.AreEquivalent(new[] { "Red" },
                GetResult(results, "Blue").Get<IReadOnlyList<IDocument>>("Members").Where(x => x.Get<bool>("IsResult")).Select(x => x["Name"]));
            CollectionAssert.AreEquivalent(new[] { "Red", "Green" },
                GetResult(results, "Blue").Get<IReadOnlyList<IDocument>>("Members").Select(x => x["Name"]));
            stream.Dispose();
        }
开发者ID:st1pps,项目名称:Wyam,代码行数:37,代码来源:AnalyzeCSharpMethodsFixture.cs


示例19: ReturnsAllTypes

            public void ReturnsAllTypes()
            {
                // Given
                string code = @"
                    namespace Foo
                    {
                        public class Blue
                        {
                        }

                        class Green
                        {
                            class Red
                            {
                            }
                        }

                        internal struct Yellow
                        {
                        }

                        enum Orange
                        {
                        }
                    }
                ";
                IDocument document = GetDocument(code);
                IExecutionContext context = GetContext();
                IModule module = new AnalyzeCSharp();

                // When
                List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                CollectionAssert.AreEquivalent(new[] { string.Empty, "Foo", "Blue", "Green", "Red", "Yellow", "Orange" }, results.Select(x => x["Name"]));
            }
开发者ID:ibebbs,项目名称:Wyam,代码行数:36,代码来源:AnalyzeCSharpTypesTests.cs


示例20: ContainingTypeIsCorrect

            public void ContainingTypeIsCorrect()
            {
                // Given
                string code = @"
                    namespace Foo
                    {
                        public class Blue
                        {
                            void Green()
                            {
                            }
                        }
                    }
                ";
                IDocument document = GetDocument(code);
                IExecutionContext context = GetContext();
                IModule module = new AnalyzeCSharp();

                // When
                List<IDocument> results = module.Execute(new[] { document }, context).ToList();  // Make sure to materialize the result list

                // Then
                Assert.AreEqual("Blue", GetMember(results, "Blue", "Green").Get<IDocument>("ContainingType")["Name"]);
            }
开发者ID:ibebbs,项目名称:Wyam,代码行数:24,代码来源:AnalyzeCSharpMethodsTests.cs



注:本文中的AnalyzeCSharp类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Analyzer类代码示例发布时间:2022-05-24
下一篇:
C# AnalysisValue类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap