Created
December 13, 2011 01:53
-
-
Save krishnabhargav/1470033 to your computer and use it in GitHub Desktop.
Simple Event Throttling Requirement Expressed as a Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class TestEventThrottling | |
{ | |
[Test] | |
public void EventsAreThrottled() | |
{ | |
var fq = new Frequent(); | |
int counter = 0; | |
fq.PropertyChanged += (s, e) => { counter++; }; | |
foreach (var prop in Enumerable.Range(0, 200)) | |
fq.Property = prop.ToString(); | |
Thread.Sleep(1000); | |
Assert.AreEqual(1, counter, "Since throttled at 1/sec"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment