예제 #1
0
        /// <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());
        }
예제 #2
0
 public void SetUpConverter()
 {
     extensionPoints = new DefaultExtensionPoints();
     converter       = new RuleBasedConverter(extensionPoints, new IConversionRule[]
     {
         new T(),
         new ConvertibleToConvertibleConversionRule()
     });
 }
예제 #3
0
        /// <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;
        }
예제 #4
0
        /// <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;
        }
예제 #5
0
        /// <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;
        }
예제 #6
0
        /// <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;
        }
예제 #7
0
        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");
 }
예제 #9
0
 /// <summary>
 /// Constructor.
 /// </summary>
 protected AbstractComparerAttribute()
 {
     extensionPoints = (IExtensionPoints)RuntimeAccessor.ServiceLocator.ResolveByComponentId("Gallio.ExtensionPoints");
 }
예제 #10
0
 public void Setup()
 {
     extensionPoints     = new DefaultExtensionPoints();
     comparisonSemantics = new DefaultComparisonSemantics(extensionPoints);
 }