private void check(TestAction action, params CheckConditions[] entries) { AddAssert($"check {action}", () => { Assert.Multiple(() => { foreach (var entry in entries) { var scrollEntry = entry as ScrollCheckConditions; var testButton = entry.Tester[action]; if (!lastEventCounts.TryGetValue(testButton, out var count)) { lastEventCounts[testButton] = count = new EventCounts(); } count.OnPressedCount += entry.OnPressedDelta; count.OnReleasedCount += entry.OnReleasedDelta; count.OnScrollCount += scrollEntry?.OnScrollCount ?? 0; Assert.AreEqual(count.OnPressedCount, testButton.OnPressedCount, $"{testButton.Concurrency} {testButton.Action} OnPressedCount"); Assert.AreEqual(count.OnReleasedCount, testButton.OnReleasedCount, $"{testButton.Concurrency} {testButton.Action} OnReleasedCount"); if (testButton is ScrollTestButton scrollTestButton && scrollEntry != null) { Assert.AreEqual(count.OnScrollCount, scrollTestButton.OnScrollCount, $"{testButton.Concurrency} {testButton.Action} OnScrollCount"); Assert.AreEqual(scrollEntry.LastScrollAmount, scrollTestButton.LastScrollAmount, $"{testButton.Concurrency} {testButton.Action} LastScrollAmount"); } } }); return(true); });
public override bool Equals(object o) { if (this == o) { return(true); } if (o == null || GetType() != o.GetType()) { return(false); } EventCounts that = (EventCounts)o; if (numEmissions != that.numEmissions) { return(false); } if (numFallbackEmissions != that.numFallbackEmissions) { return(false); } if (numCollapsed != that.numCollapsed) { return(false); } return(Equals(that.events)); }
private void check(TestAction action, params CheckConditions[] entries) { AddAssert($"check {action}", () => { Assert.Multiple(() => { foreach (var entry in entries) { var testButton = entry.Tester[action]; if (!lastEventCounts.TryGetValue(testButton, out var count)) { lastEventCounts[testButton] = count = new EventCounts(); } count.OnPressedCount += entry.OnPressedDelta; count.OnReleasedCount += entry.OnReleasedDelta; Assert.AreEqual(count.OnPressedCount, testButton.OnPressedCount, $"{testButton.Concurrency} {testButton.Action}"); Assert.AreEqual(count.OnReleasedCount, testButton.OnReleasedCount, $"{testButton.Concurrency} {testButton.Action}"); } }); return(true); }); }
private ExecutionResult(EventCounts eventCounts, long startTimestamp, int executionLatency, int userThreadLatency, Exception failedExecutionException, Exception executionException, bool executionOccurred, bool isExecutedInThread, IHystrixCollapserKey collapserKey) { this.eventCounts = eventCounts; this.startTimestamp = startTimestamp; this.executionLatency = executionLatency; this.userThreadLatency = userThreadLatency; this.failedExecutionException = failedExecutionException; this.executionException = executionException; this.executionOccurred = executionOccurred; this.isExecutedInThread = isExecutedInThread; this.collapserKey = collapserKey; }