public void ExpiresOldUniqueEvents()
        {
            int count = 0;
            service.UniqueCheckTimeLimit = TimeSpan.FromMilliseconds(10);
            service.DuplicateSuppression = DuplicateSuppressionOption.UseEquals;

            service.Subscribe<UniqueEvent>(e => count++);

            UniqueEvent nvent = new UniqueEvent { ID = Guid.NewGuid() };
            Test.WaitFor(() => false, TimeSpan.FromSeconds(.1), () => service.Publish(nvent));
            Test.WaitFor(() => count==2, TimeSpan.FromSeconds(1), () => service.Publish(nvent));

            service.UniqueCheckTimeLimit = TimeSpan.FromMinutes(1);
            Assert.True(count == 2, String.Format("UniqueEvent was not raised second time after cache expiration"));
        }
Exemple #2
0
 protected bool Equals(UniqueEvent other)
 {
     return ID.Equals(other.ID);
 }