我試圖測試競爭條件的代碼部分。我遇到的問題與唯一性驗證有關,事實證明,這種驗證在鐵軌中的競爭條件下是不安全的。我相信我可以解決這個問題,但我不知道如何測試我的解決方案。 我來最接近的是以下(靈感:http://blog.arkency.com/2015/09/testing-race-conditions/): test "Can't create duplicate keys with same
我正在開發一個C#類,其中我分配了一個數組緩衝區,並且每次事件觸發時,我都會填充數組中的下一個元素。因此,例如: class MyClass
{
private int[] buffer = new int[10];
private int index = 0;
public void EventFired(object sender, IntEventArgs