Ejemplo n.º 1
0
        public void WhenAddUsedTypesInvokedAfterEndInit_ThenThrowsInvalidOperationOperation()
        {
            var codegen = new CodeGeneration();
            codegen.EndInit();

            Assert.Throws<InvalidOperationException>(() => codegen.AddUsedTypes(typeof(Foo)));
        }
Ejemplo n.º 2
0
        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));
        }