当前位置: 首页>>代码示例>>C#>>正文


C# ConventionBuilder.ScanThisAssembly方法代码示例

本文整理汇总了C#中ConventionBuilder.ScanThisAssembly方法的典型用法代码示例。如果您正苦于以下问题:C# ConventionBuilder.ScanThisAssembly方法的具体用法?C# ConventionBuilder.ScanThisAssembly怎么用?C# ConventionBuilder.ScanThisAssembly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConventionBuilder的用法示例。


在下文中一共展示了ConventionBuilder.ScanThisAssembly方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UsingNLog

        public void UsingNLog()
        {
            var writer = GetTrace();

            LoggingConfiguration config = new LoggingConfiguration();

            TraceTarget target = new TraceTarget();
            target.Layout = "NLOG [${level:uppercase=true}] ${message}";
            config.AddTarget("trace", target);
            config.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, target));

            LogManager.Configuration = config;

            ConventionBuilder.Logger = t => LogManager.GetLogger(t);

            var builder = new ConventionBuilder();
            builder.ScanThisAssembly().For<HandlerConventions>();

            var convention = builder.Build();

            Approvals.VerifyAll(writer
                .ToString()
                .Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
                .OrderBy(s => s), "");
        }
开发者ID:distantcam,项目名称:conventional,代码行数:25,代码来源:LoggingTests.cs

示例2: VerifyConventions

        public void VerifyConventions()
        {
            var builder = new ConventionBuilder();

            builder.ScanThisAssembly()
                .For<ServiceConventions>();

            var conventions = builder.Build();

            var exception = Assert.Throws<ConventionNotFollowedException>(() => conventions.Verify());

            Approvals.Verify(exception.Message);
        }
开发者ID:distantcam,项目名称:conventional,代码行数:13,代码来源:ValidationTests.cs

示例3: CanIncludeCompilerClassesInConvention

        public void CanIncludeCompilerClassesInConvention()
        {
            var builder = new ConventionBuilder();

            builder.ScanThisAssembly()
                .For<Handler2Conventions>();

            var conventions = builder.Build();

            var exception = Assert.Throws<ConventionNotFollowedException>(() => conventions.Verify());

            Approvals.Verify(exception.Message);
        }
开发者ID:distantcam,项目名称:conventional,代码行数:13,代码来源:ValidationTests.cs

示例4: VerifyConventionsToLog

        public void VerifyConventionsToLog()
        {
            var writer = GetTrace();

            var builder = new ConventionBuilder();

            builder.ScanThisAssembly()
                .For<ServiceConventions>();

            var conventions = builder.Build();

            conventions.Verify(true);

            Approvals.Verify(writer.ToString());
        }
开发者ID:distantcam,项目名称:conventional,代码行数:15,代码来源:ValidationTests.cs

示例5: SimpleLog

        public void SimpleLog()
        {
            var writer = GetTrace();

            // Makes sure the internal logger is used.
            ConventionBuilder.Logger = t => new Conventional.Core.Logger();

            var builder = new ConventionBuilder();
            builder.ScanThisAssembly().For<HandlerConventions>();

            var convention = builder.Build();

            Approvals.Verify(new ApprovalTextWriter(writer
                .ToString()
                .Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
                .OrderBy(s => s)
                .Write("")),
                new ConfigNamer(),
                Approvals.GetReporter());
        }
开发者ID:distantcam,项目名称:conventional,代码行数:20,代码来源:LoggingTests.cs

示例6: GetBuilder

        private static ConventionBuilder GetBuilder()
        {
            var builder = new ConventionBuilder();

            builder.ScanThisAssembly()
                .For<ServiceConventions>()
                .For<ViewModelConventions>()
                .For<ModelConventions>();

            return builder;
        }
开发者ID:distantcam,项目名称:conventional,代码行数:11,代码来源:BasicUsage.cs

示例7: ReturnsEmptyListIfNoConventionFoundVariant

        public void ReturnsEmptyListIfNoConventionFoundVariant()
        {
            var builder = new ConventionBuilder();

            builder.ScanThisAssembly()
                .For<ModelConventions>()
                .For<MadeUpConventions>();

            var conventions = builder.Build();

            var models = conventions.FindAll<MadeUpConventions>(typeof(SomeModel));

            Assert.Empty(models);
        }
开发者ID:distantcam,项目名称:conventional,代码行数:14,代码来源:BasicUsage.cs

示例8: VerifyExclusionOfCompilerClasses

        public void VerifyExclusionOfCompilerClasses()
        {
            var builder = new ConventionBuilder();

            builder.ScanThisAssembly()
                .For<HandlerConventions>();

            var conventions = builder.Build();

            conventions.Verify();
        }
开发者ID:distantcam,项目名称:conventional,代码行数:11,代码来源:ValidationTests.cs


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