public void TestMissingMetadataSymbol() { AssemblyIdentity missingAssemblyId = new AssemblyIdentity("foo"); AssemblySymbol assem = new MockAssemblySymbol("banana"); ModuleSymbol module = new MissingModuleSymbol(assem, ordinal: -1); NamedTypeSymbol container = new MockNamedTypeSymbol("TestClass", Enumerable.Empty <Symbol>(), TypeKind.Class); var mms1 = new MissingMetadataTypeSymbol.TopLevel(new MissingAssemblySymbol(missingAssemblyId).Modules[0], "Elvis", "Lives", 2, true); Assert.Equal(2, mms1.Arity); Assert.Equal("Elvis", mms1.NamespaceName); Assert.Equal("Lives", mms1.Name); Assert.Equal("Elvis.Lives<,>[missing]", mms1.ToTestDisplayString()); Assert.Equal("foo", mms1.ContainingAssembly.Identity.Name); var mms2 = new MissingMetadataTypeSymbol.TopLevel(module, "Elvis.Is", "Cool", 0, true); Assert.Equal(0, mms2.Arity); Assert.Equal("Elvis.Is", mms2.NamespaceName); Assert.Equal("Cool", mms2.Name); Assert.Equal("Elvis.Is.Cool[missing]", mms2.ToTestDisplayString()); Assert.Same(assem, mms2.ContainingAssembly); // TODO: Add test for 3rd constructor. }
public void TestNamespaceExtent() { AssemblySymbol assem1 = new MockAssemblySymbol("foo"); NamespaceExtent ne1 = new NamespaceExtent(assem1); Assert.Equal(ne1.Kind, NamespaceKind.Assembly); Assert.Same(ne1.Assembly, assem1); CSharpCompilation compilation = CSharpCompilation.Create("Test"); NamespaceExtent ne2 = new NamespaceExtent(compilation); Assert.IsType<CSharpCompilation>(ne2.Compilation); Assert.Throws<InvalidOperationException>(() => ne1.Compilation); }
public void TestNamespaceExtent() { AssemblySymbol assem1 = new MockAssemblySymbol("foo"); NamespaceExtent ne1 = new NamespaceExtent(assem1); Assert.Equal(ne1.Kind, NamespaceKind.Assembly); Assert.Same(ne1.Assembly, assem1); CSharpCompilation compilation = CSharpCompilation.Create("Test"); NamespaceExtent ne2 = new NamespaceExtent(compilation); Assert.IsType <CSharpCompilation>(ne2.Compilation); Assert.Throws <InvalidOperationException>(() => ne1.Compilation); }
public void TestMissingMetadataSymbol() { AssemblyIdentity missingAssemblyId = new AssemblyIdentity("foo"); AssemblySymbol assem = new MockAssemblySymbol("banana"); ModuleSymbol module = new MissingModuleSymbol(assem, ordinal: -1); NamedTypeSymbol container = new MockNamedTypeSymbol("TestClass", Enumerable.Empty<Symbol>(), TypeKind.Class); var mms1 = new MissingMetadataTypeSymbol.TopLevel(new MissingAssemblySymbol(missingAssemblyId).Modules[0], "Elvis", "Lives", 2, true); Assert.Equal(2, mms1.Arity); Assert.Equal("Elvis", mms1.NamespaceName); Assert.Equal("Lives", mms1.Name); Assert.Equal("Elvis.Lives<,>[missing]", mms1.ToTestDisplayString()); Assert.Equal("foo", mms1.ContainingAssembly.Identity.Name); var mms2 = new MissingMetadataTypeSymbol.TopLevel(module, "Elvis.Is", "Cool", 0, true); Assert.Equal(0, mms2.Arity); Assert.Equal("Elvis.Is", mms2.NamespaceName); Assert.Equal("Cool", mms2.Name); Assert.Equal("Elvis.Is.Cool[missing]", mms2.ToTestDisplayString()); Assert.Same(assem, mms2.ContainingAssembly); // TODO: Add test for 3rd constructor. }