本文整理汇总了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), "");
}
示例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);
}
示例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);
}
示例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());
}
示例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());
}
示例6: GetBuilder
private static ConventionBuilder GetBuilder()
{
var builder = new ConventionBuilder();
builder.ScanThisAssembly()
.For<ServiceConventions>()
.For<ViewModelConventions>()
.For<ModelConventions>();
return builder;
}
示例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);
}
示例8: VerifyExclusionOfCompilerClasses
public void VerifyExclusionOfCompilerClasses()
{
var builder = new ConventionBuilder();
builder.ScanThisAssembly()
.For<HandlerConventions>();
var conventions = builder.Build();
conventions.Verify();
}