Beispiel #1
0
 public static void FillRandom <T>(ref T instance, FillArgs args, PartFlags flags, string partName)
 {
     if (flags.IsSet(PartFlags.Dynamic))
     {
         args.RaiseSkippedWarning(partName, "dynamic or polymorphic fields can't be filled");
         instance = default(T);
         return;
     }
     if (args.BeginDeferredFill <T>())
     {
         var tester = BarfSerializers.GetTester <T>(flags);
         tester.Fill(ref instance, args);
         args.EndDeferredFill <T>();
     }
 }
Beispiel #2
0
        public static void AssertAreEqual <T>(T expected, T actual, PartFlags flags, AssertArgs args, string partName)
        {
            if (flags.IsSet(PartFlags.Dynamic))
            {
                if (expected == null)
                {
                    Assert.AreEqual(null, actual);
                    return;
                }
                Assert.AreEqual(expected.GetType(), actual.GetType(), partName);

                var tester = BarfSerializers.GetTester(expected.GetType(), flags & ~PartFlags.Dynamic);
                tester.AssertAreEqual(expected, actual, args);
            }
            else
            {
                var tester = BarfSerializers.GetTester <T>(flags);
                tester.AssertAreEqual(expected, actual, args);
            }
        }