public void SimpleCountTest() { var target = new EventCounter(() => DateTimeOffset.Now, TimeSpan.FromHours(1)); target.Count("a"); target.Count("a"); target.Count("b"); target.GetCount("a").Should().Be(2); target.GetCount("b").Should().Be(1); target.GetCount("c").Should().Be(0); }
public void ClearTest() { var target = new EventCounter(() => DateTimeOffset.Now, TimeSpan.FromHours(1)); target.Count("a"); target.Count("a"); target.Clear("a"); target.GetCount("a").Should().Be(0); }
public void SurveyTimeTest() { var time = T(TimeSpan.Zero); var target = new EventCounter(() => time, TimeSpan.FromMinutes(1)); target.Count("a"); target.Count("a"); target.Count("a"); time = T(TimeSpan.FromMinutes(1)); target.Count("a"); time = T(TimeSpan.FromMinutes(2)); target.Count("a"); target.GetCount("a").Should().Be(2); }