Esempio n. 1
0
            public void Include_OnAlreadyInclude_Fail()
            {
                var harvester = new SelectiveHarvester();

                harvester.Exclude <A>(x => x.X);
                harvester.Include <A>(x => x.X);
            }
Esempio n. 2
0
            public void AddFilter_OnAlreadyInclude_Fail()
            {
                var harvester = new SelectiveHarvester();

                harvester.Include <A>(x => x.X);
                harvester.AddFilter <A>(x => null);
            }
Esempio n. 3
0
            public void Include_Fieldsarr_WorksForTypesAndSubtypes()
            {
                var harvester = new SelectiveHarvester();

                harvester.Include <B>(x => x.Name, x => x.Age);


                IFieldHarvester fh = (IFieldHarvester)harvester;

                Assert.IsFalse(fh.CanHandleType(typeof(A)));
                Assert.IsTrue(fh.CanHandleType(typeof(B)));
                var fields = fh.GetFields(typeof(B)).Select(x => x.SanitizedName);

                CollectionAssert.AreEquivalent(new[] { "Name", "Age" }, fields);

                Assert.IsFalse(fh.CanHandleType(typeof(C)));
            }
 public void Include_OnAlreadyInclude_Fail()
 {
   var harvester = new SelectiveHarvester();
   harvester.Exclude<A>(x => x.X);
   harvester.Include<A>(x => x.X);
 }
      public void Include_Fieldsarr_WorksForTypesAndSubtypes()
      {
        var harvester = new SelectiveHarvester();
        harvester.Include<B>(x => x.Name, x => x.Age);


        IFieldHarvester fh = (IFieldHarvester) harvester;
        Assert.IsFalse(fh.CanHandleType(typeof (A)));
        Assert.IsTrue(fh.CanHandleType(typeof (B)));
        var fields = fh.GetFields(typeof (B)).Select(x => x.SanitizedName);
        CollectionAssert.AreEquivalent(new[] {"Name", "Age"}, fields);

        Assert.IsFalse(fh.CanHandleType(typeof (C)));
      }
 public void AddFilter_OnAlreadyInclude_Fail()
 {
   var harvester = new SelectiveHarvester();
   harvester.Include<A>(x => x.X);
   harvester.AddFilter<A>(x => null);
 }