public void WhenAddUsedTypesInvokedAfterEndInit_ThenThrowsInvalidOperationOperation() { var codegen = new CodeGeneration(); codegen.EndInit(); Assert.Throws<InvalidOperationException>(() => codegen.AddUsedTypes(typeof(Foo))); }
public void WhenBuildingTypeMap_ThenContainsCustomAttributeTypes() { var codegen = new CodeGeneration(); codegen.AddUsedTypes(typeof(Foo)); //codegen.EndInit(); Assert.True(codegen.TypeNameMap.ContainsKey(typeof(TypeConverterAttribute).FullName)); Assert.True(codegen.TypeNameMap.ContainsKey(typeof(BarAttribute).FullName)); Assert.True(codegen.TypeNameMap.ContainsKey(typeof(BitConverter).FullName)); Assert.True(codegen.TypeNameMap.ContainsKey(typeof(System.ComponentModel.StringConverter).FullName)); Assert.True(codegen.TypeNameMap.ContainsKey(typeof(PlatformID).FullName)); }