示例#1
0
    [Test] public void TraceWithReasonAndInner2()
    {
        var t0 = new T("SetPos", next: null, reason: "Teleport");
        var t1 = new T("Reposition", next: t0, reason: null);

        o(F.LogTrace(t0), "SetPos (Teleport)");
        o(F.LogTrace(t1), "Reposition -> SetPos (Teleport)");
    }
示例#2
0
    [Test] public void Prefix()
    {
        var t = new T("SetPos", next: null, reason: null);

        t.Prefix('!');
        o(F.LogTrace(t), "!SetPos");
        t.Prefix('+');
        o(F.LogTrace(t), "+!SetPos");
    }
示例#3
0
 public LogTrace(object scope, LogTrace next, string reason)
 {
     if (!status.log)
     {
         throw new InvEx("Logging is disabled");
     }
     this.scope       = scope.ToString();
     this.isDecorator = scope is IDecorator;
     this.next        = next;
     this.reason      = TraceFormat.ReasonField(reason);
 }
示例#4
0
 public bool Matches(object scope, string reason)
 => (this.scope?.ToString()).Equals(scope) &&
 this.reason == TraceFormat.ReasonField(reason);
示例#5
0
    [Test] public void TraceDecoratorWithReason()
    {
        var t = new T(new Cooldown(), next: null, reason: "[5] Steer");

        o(F.LogTrace(t), "<C> [5] Steer");
    }
示例#6
0
    [Test] public void TraceWithReasonAndFormatArgs()
    {
        var t = new T("SetPos", next: null, reason: "Teleport here");

        o(F.LogTrace(t), "SetPos (Teleport here)");
    }
示例#7
0
    [Test] public void TraceWithReason()
    {
        var t = new T("SetPos", next: null, reason: "Teleport");

        o(F.LogTrace(t), "SetPos (Teleport)");
    }
示例#8
0
    [Test] public void LogTrace()
    {
        var t = new T("SetPos", next: null, reason: null);

        o(F.LogTrace(t), "SetPos");
    }
示例#9
0
 [Test] public void BadReason()
 {
     Assert.Throws <ArgEx>(() => F.ReasonField("(parens)"));
 }
示例#10
0
 [Test] public void ReasonField()
 {
     o(F.ReasonField(null), null);
     o(F.ReasonField(""), null);
     o(F.ReasonField("Foo"), "Foo");
 }
示例#11
0
 [Test] public void LogTrace_null()
 {
     o(F.LogTrace(null), "?trace");
 }