Ejemplo n.º 1
0
        public void PrintTuple()
        {
            Trace_.Print("v", new Tuple <int, int>(1, 2));
            StringAssert.Contains(Trace_.LastLog, "v = Tuple<int, int> (1, 2)");

            Trace_.Print("v", new Tuple <Tuple <int, int>, Tuple <int, int> >(new Tuple <int, int>(1, 2), new Tuple <int, int>(3, 4)));
            StringAssert.Contains(Trace_.LastLog, "v = Tuple<Tuple<int, int>, Tuple<int, int>> (Tuple<int, int> (1, 2), Tuple<int, int> (3, 4))");
        }
Ejemplo n.º 2
0
        public void PrintValueTuple()
        {
            Trace_.Print("v", (1, 2));
            StringAssert.Contains(Trace_.LastLog, "v = (1, 2)");

            Trace_.Print("v", ((1, 2), (3, 4)));
            StringAssert.Contains(Trace_.LastLog, "v = ((1, 2), (3, 4))");
        }
Ejemplo n.º 3
0
        public void PrintReflection()
        {
            Trace_.Print("v", new Bar(new Foo()));
            StringAssert.Contains(Trace_.LastLog, "v = DebugTraceTest.Bar {Foo: DebugTraceTest.Foo F}");

            Trace_.Print("v", new Bar(new FooSub()));
            StringAssert.Contains(Trace_.LastLog, "v = DebugTraceTest.Bar {DebugTraceTest.Foo Foo: DebugTraceTest.FooSub F}");

            Trace_.Print("v", new Bar(null));
            StringAssert.Contains(Trace_.LastLog, "v = DebugTraceTest.Bar {DebugTraceTest.Foo Foo: null}");
        }
Ejemplo n.º 4
0
        public void PrintDateTime(int year, int month, int day, int hour, int minute, int second,
                                  int millisecond, DateTimeKind kind, string expect)
        {
            var v = new DateTime(year, month, day, hour, minute, second, millisecond, kind);

            if (kind == DateTimeKind.Local)
            {
                var timeSpan = TimeZoneInfo.Local.GetUtcOffset(v);
                expect += String.Format(timeSpan.Ticks >= 0L ? @"+{0:hh\:mm} (" : @"-{0:hh\:mm} (", timeSpan);
            }
            Trace_.Print("v", v);
            StringAssert.Contains(Trace_.LastLog, expect);
        }
Ejemplo n.º 5
0
        //    [DataRow(false, true , "Result: ***")]
        //    [DataRow(true , false, "Result: ***")]
        //    [DataRow(true , true , "Result: ***")]
        public void PrintTask(bool outputNonPublicFields, bool outputNonPublicProperties, string expect)
        {
            var task = Task <int> .Run(() => { Thread.Sleep(400); return(1); });

            Thread.Sleep(10); // wait Running
            Assert.AreEqual(TaskStatus.Running, task.Status);

            TraceBase.OutputNonPublicFields     = outputNonPublicFields;
            TraceBase.OutputNonPublicProperties = outputNonPublicProperties;

            Trace_.Print("v", task);
            StringAssert.Contains(Trace_.LastLog, expect);
            Assert.AreEqual(TaskStatus.Running, task.Status);

            Trace_.Print("task.Result", task.Result);
            StringAssert.Contains(Trace_.LastLog, "task.Result = 1 (");
        }
Ejemplo n.º 6
0
 public void PrintByte(byte v, string expect)
 {
     Trace_.Print("v", v);
     StringAssert.Contains(Trace_.LastLog, expect);
 }
Ejemplo n.º 7
0
 public void PrintString(string v, string expect)
 {
     Trace_.Print("v", v);
     StringAssert.Contains(Trace_.LastLog, expect);
     Trace_.Print("Trace_.LastLog", Trace_.LastLog);
 }
Ejemplo n.º 8
0
 public void PrintChar(char v, string expect)
 {
     Trace_.Print("v", v);
     StringAssert.Contains(Trace_.LastLog, expect);
 }
Ejemplo n.º 9
0
 public void PrintEnum(Fruits Fruits, string log)
 {
     Trace_.Print("v", Fruits);
     StringAssert.Contains(Trace_.LastLog, log);
 }
Ejemplo n.º 10
0
 public void PrintPoint(int x, int y, string expect)
 {
     Trace_.Print("v", new Point(x, y));
     StringAssert.Contains(Trace_.LastLog, expect);
 }
Ejemplo n.º 11
0
 public void PrintGuid(string v, string expect)
 {
     Trace_.Print("v", new Guid(v));
     StringAssert.Contains(Trace_.LastLog, expect);
 }
Ejemplo n.º 12
0
 public void PrintFloat(float v, string expect)
 {
     Trace_.Print("v", v);
     StringAssert.Contains(Trace_.LastLog, expect);
 }
Ejemplo n.º 13
0
 public void PrintDecimal(string v, string expect)
 {
     Trace_.Print("v", decimal.Parse(v));
     StringAssert.Contains(Trace_.LastLog, expect);
 }
Ejemplo n.º 14
0
 public void PrintULong(ulong v, string expect)
 {
     Trace_.Print("v", v);
     StringAssert.Contains(Trace_.LastLog, expect);
 }
Ejemplo n.º 15
0
 public void PrintUShort(ushort v, string expect)
 {
     Trace_.Print("v", v);
     StringAssert.Contains(Trace_.LastLog, expect);
 }