Example #1
0
        public void CheckerFactoryRegisterTypeViaGeneric()
        {
            var cc = new CheckerConventions();

            cc.Convention <SampleClass>(CompareTarget.Ignore);

            Assert.That(cc.TypeConventions.CompareTarget.Convention(typeof(SampleClass)), Is.EqualTo(CompareTarget.Ignore));
        }
Example #2
0
        public static void AssignTypeConventions(this CheckerConventions conventions)
        {
            // NB Must have this one to put base behaviour in suchs as Guid
            conventions.TypeConventions.InitializeTypeConventions();

            // NB Conventions must be after general type registrations if they are to apply.
            conventions.Convention(x => typeof(IIdentifiable).IsAssignableFrom(x), CompareTarget.Id);
        }
Example #3
0
        public static void AssignComparerConventions(this CheckerConventions conventions)
        {
            // NB We have an extension to use a function for a type or we can do it explicitly if we want more context
            conventions.ComparerConvention <double>(AbsDouble);
            conventions.ComparerConvention <double?>(AbsDouble);

            conventions.ComparerConvention <float>(AbsFloat);
            conventions.ComparerConvention <float?>(AbsFloat);
            conventions.ComparerConvention <float>(x => (x == typeof(float)), AbsFloat);
        }
Example #4
0
 public static void AssignPropertyInfoConventions(this CheckerConventions conventions)
 {
     //conventions.Convention(x => typeof(IIdentifiable).IsAssignableFrom(x), CompareTarget.Id);
     conventions.Convention((PropertyInfo x) => x.Name == "Ignore", CompareTarget.Ignore);
 }