public void BackupEngineCanStartAndStop() { var logger = new MockLogger(); var db = new SQLServerClientDatabase(TestConnectionString, new MockLogger(), SharedMockedCoreSettings); var engine = new BackupEngine(db, logger, 0, SharedMockedCoreSettings); engine.BeginStart(); engine.BeginStop(); }
public void BackupEngineTriggersStoppedEventWhenEngineHasStopped() { var logger = new MockLogger(); var db = new SQLServerClientDatabase(TestConnectionString, new MockLogger(), SharedMockedCoreSettings); var engine = new BackupEngine(db, logger, 0, SharedMockedCoreSettings); var signalStoppedEvent = new AutoResetEvent(false); engine.Stopped += (s, e) => { signalStoppedEvent.Set(); }; engine.BeginStart(); engine.BeginStop(); var engineStoppedSignaled = signalStoppedEvent.WaitOne(TimeSpan.FromSeconds(5)); Assert.IsTrue(engineStoppedSignaled); }