public void TestKey() { var itemWithoutScope = new DefaultMetadata() { Path = "" }; var itemWithScope = new DefaultMetadata() { Path = "", Scope = "" }; var itemWithNamedScope = new DefaultMetadata() { Path = "", Scope = "posts" }; var itemPathWithNameScope = new DefaultMetadata() { Path = "2019", Scope = "posts" }; var data = new DefaultMetadatas { itemWithoutScope, itemWithScope, itemWithNamedScope, itemPathWithNameScope }; data[""].Should().NotBeNull(); data["."].Should().NotBeNull(); data[".posts"].Should().NotBeNull(); data["2019.posts"].Should().NotBeNull(); }
public static CSharpCompilation CreateCompilation( IEnumerable <SyntaxTree> syntaxTrees, CSharpCompilationOptions compilationOptions, IEnumerable <MetadataReference> additionalMetadatas = null, string assemblyName = "TestAssembly") { additionalMetadatas ??= Array.Empty <MetadataReference>(); return(CSharpCompilation.Create( assemblyName: assemblyName, syntaxTrees: syntaxTrees, references: DefaultMetadatas.Concat(additionalMetadatas), options: compilationOptions)); }