public async Task CanParseSupportedCollections() { LazinatorCompilation lazinatorFiles = await GetMiniRoslynFileSet(typeof(DotNetList_Lazinator)); string interfaceName = "IDotNetList_Lazinator"; var interfaceSymbol = lazinatorFiles.LookupSymbol(interfaceName); var properties = lazinatorFiles.PropertiesForType[LazinatorCompilation.TypeSymbolToString(interfaceSymbol)]; var property = properties.First().Property; property.Type.Name.Should().Be("List"); (property.Type is INamedTypeSymbol).Should().BeTrue(); var namedType = property.Type as INamedTypeSymbol; namedType.TypeArguments.Count().Should().Be(1); var typeArgument = namedType.TypeArguments[0]; typeArgument.Name.Should().Be("ExampleChild"); INamedTypeSymbol exampleChildClass = lazinatorFiles.LookupSymbol(typeArgument.Name); exampleChildClass.IsReferenceType.Should().BeTrue(); }
public async Task CanParseInterfaceAttributes() { try { LazinatorCompilation lazinatorFiles = await GetMiniRoslynFileSet(typeof(Example)); INamedTypeSymbol exampleInterface = lazinatorFiles.LookupSymbol("IExample"); ImmutableArray <AttributeData> attributes = exampleInterface.GetAttributes(); attributes.Count().Should().BeGreaterOrEqualTo(1); Attribute converted = AttributeConverter.ConvertAttribute(attributes[0]); LazinatorAnalyzer.AttributeClones.CloneLazinatorAttribute cloneLazinatorAttribute = converted as LazinatorAnalyzer.AttributeClones.CloneLazinatorAttribute; cloneLazinatorAttribute.UniqueID.Should().NotBe(0); } catch (IOException) { // occurs rarely if other process is looking up same file at same time, so let's ignore it } }