Example #1
0
        protected static bool IsVerticalTable(Table table, RuntimeBindingType runtimeBindingType)
        {
            if (table.Header.Count != 2)
                return false;

            if (table.RowCount == 0)
                return true;

            var writableProperties = GetWritableProperties(runtimeBindingType.Type);
            return writableProperties.ContainsKey(SanitizePropertyName(table.Rows[0][0]));
        }
        private Table GetVerticalTable(Table table, RuntimeBindingType runtimeBindingType)
        {
            if (IsVerticalTable(table, runtimeBindingType))
                return table;

            if (table.Rows.Count == 1)
            {
                var pivotedTable = new PivotTable(table).GetInstanceTable(0);

                if (IsVerticalTable(pivotedTable, runtimeBindingType))
                    return pivotedTable;
            }

            return null;
        }
Example #3
0
            public bool CanConvert(object value, IBindingType typeToConvertTo, CultureInfo cultureInfo)
            {
                if (!(typeToConvertTo is RuntimeBindingType))
                {
                    Type systemType = Type.GetType(typeToConvertTo.FullName, false);
                    if (systemType == null)
                        return false;
                    typeToConvertTo = new RuntimeBindingType(systemType);
                }

                return StepArgumentTypeConverter.CanConvertSimple(typeToConvertTo, value, cultureInfo);
            }
            public bool CanConvert(object value, IBindingType typeToConvertTo, CultureInfo cultureInfo)
            {
                if (!(typeToConvertTo is RuntimeBindingType))
                {
                    try
                    {
                        // in some special cases, Type.GetType throws exception
                        // one of such case, if a Dictionary<string,string> step parameter is specified, see issue #340
                        Type systemType = Type.GetType(typeToConvertTo.FullName, false);
                        if (systemType == null)
                            return false;
                        typeToConvertTo = new RuntimeBindingType(systemType);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex);
                        return false;
                    }
                }

                return StepArgumentTypeConverter.CanConvertSimple(typeToConvertTo, value, cultureInfo);
            }
Example #5
0
 protected bool Equals(RuntimeBindingType other)
 {
     return(Equals(Type, other.Type));
 }
Example #6
0
 protected bool Equals(RuntimeBindingType other)
 {
     return Equals(Type, other.Type);
 }