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))"); }
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))"); }
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}"); }
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); }
// [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 ("); }
public void PrintByte(byte v, string expect) { Trace_.Print("v", v); StringAssert.Contains(Trace_.LastLog, expect); }
public void PrintString(string v, string expect) { Trace_.Print("v", v); StringAssert.Contains(Trace_.LastLog, expect); Trace_.Print("Trace_.LastLog", Trace_.LastLog); }
public void PrintChar(char v, string expect) { Trace_.Print("v", v); StringAssert.Contains(Trace_.LastLog, expect); }
public void PrintEnum(Fruits Fruits, string log) { Trace_.Print("v", Fruits); StringAssert.Contains(Trace_.LastLog, log); }
public void PrintPoint(int x, int y, string expect) { Trace_.Print("v", new Point(x, y)); StringAssert.Contains(Trace_.LastLog, expect); }
public void PrintGuid(string v, string expect) { Trace_.Print("v", new Guid(v)); StringAssert.Contains(Trace_.LastLog, expect); }
public void PrintFloat(float v, string expect) { Trace_.Print("v", v); StringAssert.Contains(Trace_.LastLog, expect); }
public void PrintDecimal(string v, string expect) { Trace_.Print("v", decimal.Parse(v)); StringAssert.Contains(Trace_.LastLog, expect); }
public void PrintULong(ulong v, string expect) { Trace_.Print("v", v); StringAssert.Contains(Trace_.LastLog, expect); }
public void PrintUShort(ushort v, string expect) { Trace_.Print("v", v); StringAssert.Contains(Trace_.LastLog, expect); }