示例#1
0
        public void Calling_save_marks_as_dirty()
        {
            var strategy = new BackgroundSave(TimeSpan.FromSeconds(10));

            strategy.ShouldSaveNow();
            Assert.True(strategy.IsDirty);
        }
示例#2
0
 public void Should_not_notify_save_when_not_dirty()
 {
     using (var sem = new Semaphore(0, 1)) {
         var saveCalled = false;
         var strategy   = new BackgroundSave(TimeSpan.FromSeconds(10));
         strategy.NotifyUnsolicitedSave += (sender, args) => {
             saveCalled = true;
             sem.Release();
         };
         TimeMachine.UnblockOneOrMoreDelays();
         sem.WaitOne(100);
         Assert.False(saveCalled);
     }
 }