/// <summary> /// Constructor. /// </summary> /// <param name="extensionPoints"></param> public DefaultComparisonSemantics(IExtensionPoints extensionPoints) { if (extensionPoints == null) { throw new ArgumentNullException("extensionPoints"); } this.extensionPoints = extensionPoints; // Register primitive differences. AddPrimitiveDifferencer <SByte, Int32>((a, b) => a - b); AddPrimitiveDifferencer <Byte, Int32>((a, b) => a - b); AddPrimitiveDifferencer <Int16, Int32>((a, b) => a - b); AddPrimitiveDifferencer <UInt16, Int32>((a, b) => a - b); AddPrimitiveDifferencer <Int32, Int32>((a, b) => a - b); AddPrimitiveDifferencer <UInt32, UInt32>((a, b) => a - b); AddPrimitiveDifferencer <Int64, Int64>((a, b) => a - b); AddPrimitiveDifferencer <UInt64, UInt64>((a, b) => a - b); AddPrimitiveDifferencer <Single, Single>((a, b) => a - b); AddPrimitiveDifferencer <Double, Double>((a, b) => a - b); AddPrimitiveDifferencer <Char, Int32>((a, b) => a - b); AddSpecialEqualityFunc <AssemblyName>((a, b) => a.FullName == b.FullName); AddSpecialEqualityFunc <DirectoryInfo>((a, b) => a.ToString() == b.ToString()); AddSpecialEqualityFunc <FileInfo>((a, b) => a.ToString() == b.ToString()); }
public void SetUpConverter() { extensionPoints = new DefaultExtensionPoints(); converter = new RuleBasedConverter(extensionPoints, new IConversionRule[] { new T(), new ConvertibleToConvertibleConversionRule() }); }
/// <summary> /// Creates a rule-based converter. /// </summary> /// <param name="extensionPoints">The entry point for framework extensions.</param> /// <param name="rules">The rules to use.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="rules"/> is null.</exception> public RuleBasedConverter(IExtensionPoints extensionPoints, IConversionRule[] rules) { if (extensionPoints == null) throw new ArgumentNullException("extensionPoints"); if (rules == null) throw new ArgumentNullException("rules"); this.rules = new List<IConversionRule>(rules); this.conversions = new Dictionary<ConversionKey, ConversionInfo>(); this.extensionPoints = extensionPoints; }
/// <summary> /// Creates a rule-based formatter. /// </summary> /// <param name="rules">The rules to use.</param> /// <param name="extensionPoints">The entry point for framework extensions.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="rules"/> is null.</exception> public RuleBasedFormatter(IExtensionPoints extensionPoints, IFormattingRule[] rules) { if (extensionPoints == null) throw new ArgumentNullException("extensionPoints"); if (rules == null) throw new ArgumentNullException("rules"); this.rules = new List<IFormattingRule>(rules); this.preferredRules = new Dictionary<Type, IFormattingRule>(); this.extensionPoints = extensionPoints; }
/// <summary> /// Creates a rule-based formatter. /// </summary> /// <param name="rules">The rules to use.</param> /// <param name="extensionPoints">The entry point for framework extensions.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="rules"/> is null.</exception> public RuleBasedFormatter(IExtensionPoints extensionPoints, IFormattingRule[] rules) { if (extensionPoints == null) { throw new ArgumentNullException("extensionPoints"); } if (rules == null) { throw new ArgumentNullException("rules"); } this.rules = new List <IFormattingRule>(rules); this.preferredRules = new Dictionary <Type, IFormattingRule>(); this.extensionPoints = extensionPoints; }
/// <summary> /// Creates a rule-based converter. /// </summary> /// <param name="extensionPoints">The entry point for framework extensions.</param> /// <param name="rules">The rules to use.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="rules"/> is null.</exception> public RuleBasedConverter(IExtensionPoints extensionPoints, IConversionRule[] rules) { if (extensionPoints == null) { throw new ArgumentNullException("extensionPoints"); } if (rules == null) { throw new ArgumentNullException("rules"); } this.rules = new List <IConversionRule>(rules); this.conversions = new Dictionary <ConversionKey, ConversionInfo>(); this.extensionPoints = extensionPoints; }
public void SetUpFormatter() { extensionPoints = new DefaultExtensionPoints(); IConverter converter = new RuleBasedConverter(extensionPoints, new IConversionRule[] { new ObjectToStringConversionRule() }); formattingRule = new T(); formatter = new RuleBasedFormatter(extensionPoints, new IFormattingRule[] { formattingRule, new ConvertToStringFormattingRule(converter) }); }
/// <summary> /// Constructor. /// </summary> protected AbstractComparerAttribute() { extensionPoints = (IExtensionPoints)RuntimeAccessor.ServiceLocator.ResolveByComponentId("Gallio.ExtensionPoints"); }
public void Setup() { extensionPoints = new DefaultExtensionPoints(); comparisonSemantics = new DefaultComparisonSemantics(extensionPoints); }