public void CaptureLogs(ITestOutputHelper testOutputHelper) { const string captureCorrelationId = nameof(captureCorrelationId); var captureId = Guid.NewGuid(); var callContextData = new AsyncLocal <Tuple <string, Guid> > { Value = new Tuple <string, Guid>(captureCorrelationId, captureId) }; bool Filter(LogEvent logEvent) => callContextData !.Value !.Item2.Equals(captureId); MessageTemplateTextFormatter formatter = new MessageTemplateTextFormatter( "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] [{SourceContext}] {Message}"); MessageTemplateTextFormatter formatterWithException = new MessageTemplateTextFormatter( "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level:u3}] [{SourceContext}] {Message}{NewLine}{Exception}"); var subscription = LogEventSubject.Where(Filter).Subscribe(logEvent => { using var writer = new StringWriter(); if (logEvent.Exception != null) { formatterWithException.Format(logEvent, writer); } else { formatter.Format(logEvent, writer); } testOutputHelper.WriteLine(writer.ToString()); }); _disposables.Add(subscription); }
public override bool Equals(object obj) { if (!(obj is Tuple)) { return(false); } var tuple = (Tuple <T1, T2, T3>)obj; return(Item1.Equals(tuple.Item1) && Item2.Equals(tuple.Item2) && Item3.Equals(tuple.Item3)); }
public override bool Equals(object obj) { var t = obj as Tuple <T1, T2, T3>; if (t == null) { return(false); } return(Item1.Equals(t.Item1) && Item2.Equals(t.Item2) && Item3.Equals(t.Item3)); }
public override bool Equals(object obj) { if (obj == null || (obj as Triple <T1, T2, T3>) == null) //if the object is null or the cast fails { return(false); } else { Triple <T1, T2, T3> tuple = (Triple <T1, T2, T3>)obj; return(Item1.Equals(tuple.Item1) && Item2.Equals(tuple.Item2) && Item3.Equals(tuple.Item3)); } }
public K GetOther(K key) { if (Item1.Equals(key)) { return(Item2); } if (Item2.Equals(key)) { return(Item1); } throw new KeyNotFoundException(); }
public override bool Equals(object obj) { if (obj is DoubleKey) { DoubleKey other = obj as DoubleKey; if (Item1.Equals(other.Item1) && Item2.Equals(other.Item2) || Item1.Equals(other.Item2) && Item2.Equals(other.Item1)) { return(true); } } return(false); }
public bool Contains(object obj) { if (obj != null) { if (obj is T1 && Item1.Equals((T1)obj)) { return(true); } if (obj is T2 && Item2.Equals((T2)obj)) { return(true); } if (obj is T3 && Item3.Equals((T3)obj)) { return(true); } } return(false); }
public void AddItem(BaseBrainItem item) { if ((Item1 != null && Item1.Equals(item)) || (Item2 != null && Item2.Equals(item))) { return; } else if (item is UIHypothesisItem && Item2 is UIHypothesisItem) { SetItem2(item); } else if (item is UIHypothesisItem && Item1 is UIHypothesisItem) { SetItem1(item); } else if (Item1 == null) { SetItem1(item); } else if (Item2 == null) { SetItem2(item); } else if (item is UIFactItem && Item2 is UIHypothesisItem) { SetItem1(item); } else if (item is UIFactItem && Item1 is UIHypothesisItem) { SetItem2(item); } else { SetItem2(item); } Refresh(); }
public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } var that = (CustomTuple)obj; if (Item1 == null && that.Item1 != null || Item1 != null && that.Item1 == null) { return(false); } if (Item2 == null && that.Item2 != null || Item2 != null && that.Item2 == null) { return(false); } if (!Item2.Equals(that.Item2)) { return(false); } if (that.Item1.Count != Item1.Count) { return(false); } for (int i = 0; i < Item1.Count; i++) { if (!Item1[i].Equals(that.Item1[i])) { return(false); } } return(true); }
public bool Equals(Triple other) { return(Item1.Equals(other.Item1) && Item2.Equals(other.Item2) && Item3.Equals(other.Item3)); }
bool IEquatable <UnordererPair <T> > .Equals(UnordererPair <T> other) { return ((Item1.Equals(other.Item1) && Item2.Equals(other.Item2)) || (Item1.Equals(other.Item2) && Item2.Equals(other.Item1))); }
/// <summary> /// Determines whether the given object is equal to this one. /// </summary> /// <param name="obj">The other object be compared with.</param> /// <returns>True if they are equal, false otherwise.</returns> public override bool Equals(object obj) { var other = obj as TownTuple; return(other == null ? false : Item1.Equals(other.Item1) && Item2.Equals(other.Item2)); }
public bool Equals(ValueTuple <T1, T2, T3> other) { var(item1, item2, item3) = other; return((Item1?.Equals(item1) ?? item1 == null) && (Item2?.Equals(item2) ?? item2 == null) && (Item3?.Equals(item3) ?? item3 == null)); }
public bool Contains(K key) { return(Item1.Equals(key) || Item2.Equals(key)); }