Beispiel #1
0
        public void SetUp()
        {
            SerializerDebugging.DeletePastTemporaries();
            //SerializerDebugging.TraceEnabled = true;
            //SerializerDebugging.DumpEnabled = true;
            if (SerializerDebugging.TraceEnabled)
            {
                Tracer.Emit.Listeners.Clear();
                Tracer.Emit.Switch.Level = SourceLevels.All;
#if NETSTANDARD2_0
                Tracer.Emit.Listeners.Add(new TextWriterTraceListener(Console.Out));
#else // NETSTANDRD2_0
                Tracer.Emit.Listeners.Add(new ConsoleTraceListener());
#endif // NETSTANDRD2_0
            }

            SerializerDebugging.DependentAssemblyManager      = new TempFileDependentAssemblyManager(TestContext.CurrentContext.TestDirectory);
            SerializerDebugging.OnTheFlyCodeGenerationEnabled = true;
#if NET35
            SerializerDebugging.SetCodeCompiler(CodeDomCodeGeneration.Compile);
#else
            SerializerDebugging.SetCodeCompiler(RoslynCodeGeneration.Compile);
#endif // NET35
            SerializerDebugging.AddRuntimeAssembly(this.GetType().Assembly.Location);
        }
        public void SetUp()
        {
#if !NETSTANDARD1_1 && !NETSTANDARD1_3
            //SerializerDebugging.TraceEnabled = true;
            //SerializerDebugging.DumpEnabled = true;
            if (SerializerDebugging.TraceEnabled)
            {
                Tracer.Emit.Listeners.Clear();
                Tracer.Emit.Switch.Level = SourceLevels.All;
                Tracer.Emit.Listeners.Add(new ConsoleTraceListener());
            }

            SerializerDebugging.DependentAssemblyManager = new TempFileDependentAssemblyManager(TestContext.CurrentContext.TestDirectory);
            SerializerDebugging.DeletePastTemporaries();
            SerializerDebugging.OnTheFlyCodeGenerationEnabled = true;

#if NETFX_35
            SerializerDebugging.SetCodeCompiler(CodeDomCodeGeneration.Compile);
#else
            SerializerDebugging.SetCodeCompiler(RoslyCodeGeneration.Compile);
#endif // NETFX_35

            SerializerDebugging.DumpDirectory = TestContext.CurrentContext.TestDirectory;
            SerializerDebugging.AddRuntimeAssembly(typeof(AddOnlyCollection <>).Assembly.Location);
            if (typeof(AddOnlyCollection <>).Assembly != this.GetType().Assembly)
            {
                SerializerDebugging.AddRuntimeAssembly(this.GetType().Assembly.Location);
            }
#endif // !NETSTANDARD1_1 && !NETSTANDARD1_3
        }
        public void SetUp()
        {
            SerializerDebugging.DeletePastTemporaries();
            //SerializerDebugging.TraceEnabled = true;
            //SerializerDebugging.DumpEnabled = true;
            if (SerializerDebugging.TraceEnabled)
            {
                Tracer.Emit.Listeners.Clear();
                Tracer.Emit.Switch.Level = SourceLevels.All;
                Tracer.Emit.Listeners.Add(new ConsoleTraceListener());
            }

            SerializerDebugging.OnTheFlyCodeDomEnabled = true;
            SerializerDebugging.AddRuntimeAssembly(typeof(ImmutableList).Assembly.Location);
        }
        public void SetUp()
        {
            SerializerDebugging.DeletePastTemporaries();
            //SerializerDebugging.TraceEnabled = true;
            //SerializerDebugging.DumpEnabled = true;
            if (SerializerDebugging.TraceEnabled)
            {
                Tracer.Emit.Listeners.Clear();
                Tracer.Emit.Switch.Level = SourceLevels.All;
                Tracer.Emit.Listeners.Add(new ConsoleTraceListener());
            }

            SerializerDebugging.OnTheFlyCodeDomEnabled = true;
            SerializerDebugging.AddRuntimeAssembly(this.GetType().Assembly.Location);
            if (this.GetType().Assembly != typeof(NilImplicationTestTargetForValueTypeMemberDefault).Assembly)
            {
                SerializerDebugging.AddRuntimeAssembly(typeof(NilImplicationTestTargetForValueTypeMemberDefault).Assembly.Location);
            }
        }
Beispiel #5
0
 public void TestPerformance()
 {
     SerializerDebugging.OnTheFlyCodeDomEnabled = true;
     SerializerDebugging.AddRuntimeAssembly(Assembly.GetExecutingAssembly().Location);
     Console.WriteLine(
         "Flavor\tMethod\tEnumMethod\tMin(usec,gen)\tMax(usec,gen)\tAvg(usec,gen)\tStdDiv(gen)\tMin(usec,pack)\tMax(usec,pack)\tAvg(usec,pack)\tStdDiv(usec,pack)\tMin(usec,unpack)\tMax(usec,unpack)\tAvg(usec,unpack)\tStdDiv(usec,unpack)"
         );
     foreach (var flavor in
              new[] { EmitterFlavor.FieldBased, EmitterFlavor.ContextBased, EmitterFlavor.ExpressionBased, EmitterFlavor.CodeDomBased, EmitterFlavor.ReflectionBased })
     {
         foreach (var serializationMethod in new[] { SerializationMethod.Array, SerializationMethod.Map })
         {
             foreach (var enumSerializationMethod in new[] { EnumSerializationMethod.ByName, EnumSerializationMethod.ByUnderlyingValue })
             {
                 var result = Test(flavor, serializationMethod, enumSerializationMethod);
                 Console.WriteLine(
                     "{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}",
                     flavor,
                     serializationMethod,
                     enumSerializationMethod,
                     result[0].MinElapsedTicks / 10.0,
                     result[0].MaxElapsedTicks / 10.0,
                     result[0].AverageElapsedTicks / 10.0,
                     result[0].StandardDeviation / 10.0,
                     result[1].MinElapsedTicks / 10.0,
                     result[1].MaxElapsedTicks / 10.0,
                     result[1].AverageElapsedTicks / 10.0,
                     result[1].StandardDeviation / 10.0,
                     result[2].MinElapsedTicks / 10.0,
                     result[2].MaxElapsedTicks / 10.0,
                     result[2].AverageElapsedTicks / 10.0,
                     result[2].StandardDeviation / 10.0
                     );
             }
         }
     }
 }