public void WhenBuildingTypeMap_ThenAlwaysContainsSystemDrawing() { var codegen = new ProductCodeGeneration<IElementInfo, IElement>(this.element); codegen.EndInit(); Assert.Equal("UITypeEditor", codegen.TypeNameMap["System.Drawing.Design.UITypeEditor"], "Unique type name should be in simple form."); Assert.True(codegen.SafeImports.Contains("System.Drawing.Design")); }
public void WhenBuildingTypeMap_ThenAlwaysContainsSystemDrawing() { var codegen = new ProductCodeGeneration <IElementInfo, IElement>(this.element); codegen.EndInit(); Assert.Equal("UITypeEditor", codegen.TypeNameMap["System.Drawing.Design.UITypeEditor"], "Unique type name should be in simple form."); Assert.True(codegen.SafeImports.Contains("System.Drawing.Design")); }
public void WhenBuildingTypeMap_ThenContainsVariablePropertiesUsedTypes() { var codegen = new ProductCodeGeneration<IElementInfo, IElement>(this.element); codegen.EndInit(); Assert.Equal("String", codegen.TypeNameMap["System.String"], "Unique type name should be in simple form."); Assert.Equal("UIEditor", codegen.TypeNameMap["System.ComponentModel.UIEditor, System"], "Unique type name should be in simple form."); Assert.Equal("System.ComponentModel.StringConverter", codegen.TypeNameMap["System.ComponentModel.StringConverter, System"], "Duplicated type name should exist in full form."); Assert.Equal("NuPattern.StringConverter", codegen.TypeNameMap["NuPattern.StringConverter, Microsoft"], "Duplicated type name should exist in full form."); Assert.Equal("MultilineStringEditor", codegen.TypeNameMap["System.ComponentModel.Design.MultilineStringEditor, System.Design"]); Assert.True(codegen.SafeImports.Contains("System")); Assert.True(codegen.SafeImports.Contains("System.ComponentModel")); Assert.True(codegen.SafeImports.Contains("System.ComponentModel.Design")); Assert.False(codegen.SafeImports.Contains("NuPattern")); }
public void WhenBuildingTypeMap_ThenContainsVariablePropertiesUsedTypes() { var codegen = new ProductCodeGeneration <IElementInfo, IElement>(this.element); codegen.EndInit(); Assert.Equal("String", codegen.TypeNameMap["System.String"], "Unique type name should be in simple form."); Assert.Equal("UIEditor", codegen.TypeNameMap["System.ComponentModel.UIEditor, System"], "Unique type name should be in simple form."); Assert.Equal("System.ComponentModel.StringConverter", codegen.TypeNameMap["System.ComponentModel.StringConverter, System"], "Duplicated type name should exist in full form."); Assert.Equal("NuPattern.StringConverter", codegen.TypeNameMap["NuPattern.StringConverter, Microsoft"], "Duplicated type name should exist in full form."); Assert.Equal("MultilineStringEditor", codegen.TypeNameMap["System.ComponentModel.Design.MultilineStringEditor, System.Design"]); Assert.True(codegen.SafeImports.Contains("System")); Assert.True(codegen.SafeImports.Contains("System.ComponentModel")); Assert.True(codegen.SafeImports.Contains("System.ComponentModel.Design")); Assert.False(codegen.SafeImports.Contains("NuPattern")); }
public void WhenBuildingTypeMap_ThenHasStandardValuesEditor() { var pattern = new Mock <IPatternInfo>(); pattern.Setup(x => x.Properties) .Returns(new[] { Mocks.Of <IPropertyInfo>().First(p => p.Type == "System.String"), }); var codegen = new ProductCodeGeneration <IPatternInfo, IProduct>(pattern.Object); var typeName = typeof(StandardValuesEditor).FullName + ", " + typeof(StandardValuesEditor).Assembly.GetName().Name; codegen.AddType(typeName); codegen.EndInit(); Assert.True(codegen.SafeImports.Contains(typeof(StandardValuesEditor).Namespace)); Assert.Equal(typeof(StandardValuesEditor).Name, codegen.GetTypeName(typeName)); }
public void WhenBuildingTypeMap_ThenHasStandardValuesEditor() { var pattern = new Mock<IPatternInfo>(); pattern.Setup(x => x.Properties) .Returns(new[] { Mocks.Of<IPropertyInfo>().First(p => p.Type == "System.String"), }); var codegen = new ProductCodeGeneration<IPatternInfo, IProduct>(pattern.Object); var typeName = typeof(StandardValuesEditor).FullName + ", " + typeof(StandardValuesEditor).Assembly.GetName().Name; codegen.AddType(typeName); codegen.EndInit(); Assert.True(codegen.SafeImports.Contains(typeof(StandardValuesEditor).Namespace)); Assert.Equal(typeof(StandardValuesEditor).Name, codegen.GetTypeName(typeName)); }