CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

ConventionRegistry test run

144 Views
Copy Code Show/Hide Line Numbers
public class FakeConventionRegistry :  ConventionRegistry
{
    public FakeConventionRegistry()
    {
        Part<PartConvention>()
            .ForTypesMatching(x => x.IsPublic && x.IsAbstract == false)
            .MakeShared()
            .Imports(x =>
            {
                x.Import<ImportConvention>()
                    .As<IImportConvention>("ContractName")
                    .MakeNonShared()
                    .RequireMetadata<IMetadataView>()
                    .Recomposable()
                    .AllowDefaultValue()
                    .Members<ImportConvention>(m => m.ContractType);
 
                x.Import<ImportConvention>()
                    .As("TestContractName")
                    .Members(m => m.GetProperties(BindingFlags.Public | BindingFlags.Instance))
                    .AllowDefaultValue();
            })
            .Exports(e =>
            {
                e.Export<ExportConvention>()
                    .As<IExportConvention>("ExportContractName")
                    .Members(m => m.GetProperties().Where(p => p.Name.StartsWith("M")).ToArray());
            });
 
       Part<PartConvention>()
            .ForTypesMatching(x => x.IsPublic && x.IsAbstract == false)
            .MakeShared()
 
       Part<PartConvention>()
            .ForTypesMatching(x => x.IsPublic && x.IsAbstract == false)
            .MakeShared()
 
       Part<PartConvention>()
            .ForTypesMatching(x => x.IsPublic && x.IsAbstract == false)
            .MakeShared()
 
       Part<PartConvention>()
            .ForTypesMatching(x => x.IsPublic && x.IsAbstract == false)
            .MakeShared()
 
       Part<PartConvention>()
            .ForTypesMatching(x => x.IsPublic && x.IsAbstract == false)
            .MakeShared()
    }
}
by TheCodeJunkie
  February 01, 2010 @ 1:33pm

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate