public async Task UpdatesLocalDB() { var svrDb = SampleDB1.CreateInTemp(); var locDb = svrDb.MakeTempCopy(".LiteDB"); var servr = FcServer.StartWith(svrDb, 5, out VersionKeeperSettings cfg); var chekr = await FcClient.StartWith(locDb, cfg); svrDb.AddRecords(1); await Task.Delay(1000 * 2); locDb.MustMatchMaxIdOf(svrDb); await TmpDir.Cleanup(servr, svrDb, chekr, locDb); }
public async Task UpdatesColdTarget() { var svrFile = CreateFile.WithRandomText(); var locFile = svrFile.MakeTempCopy(".locFile1"); var server = FcServer.StartWith(svrFile, 1, out VersionKeeperSettings cfg); var client = await FcClient.StartWith(locFile, cfg); FileChange.Trigger(svrFile); await Task.Delay(1000 * 2); locFile.MustMatchHashOf(svrFile); await TmpDir.Cleanup(server, svrFile, client, locFile); }
public async Task UpdatesRunningExe() { var svrExe = CreateFile.TempCopy("windirstat.exe"); var locExe = svrExe.MakeTempCopy("locWds.exe"); var server = FcServer.StartWith(svrExe, 3, out VersionKeeperSettings cfg); var client = await FcClient.StartWith(locExe, cfg); var locPrc = Process.Start(locExe); FileChange.Trigger(svrExe); await Task.Delay(1000 * 2); locExe.MustMatchHashOf(svrExe); locPrc.Kill(); locPrc.Dispose(); await TmpDir.Cleanup(server, svrExe, client, locExe); }
public async Task UpdatesSelf() { var svrExe = FcClient.GetDebugExe().MakeTempCopy(".dbgSvrExe"); var server = FcServer.StartWith(svrExe, 4, out VersionKeeperSettings cfg, CheckerRelease.FileKey); var client = await FcClient.StartWith("", cfg, true); var updatr = client.MainModule.FileName; FileChange.Trigger(svrExe); await Task.Delay(1000 * 4); updatr.MustMatchHashOf(svrExe); var newProc = FcClient.FindRunningProcess(); await TmpDir.Cleanup(server, svrExe, newProc, updatr); }
public async Task UpdatesHotSource() { var svrFile = CreateFile.WithRandomText(); var locFile = svrFile.MakeTempCopy(".locFile2"); var server = FcServer.StartWith(svrFile, 2, out VersionKeeperSettings cfg); FileChange.Trigger(svrFile); var fileRef = new FileStream(svrFile, FileMode.Open, FileAccess.ReadWrite); var client = await FcClient.StartWith(locFile, cfg); await Task.Delay(1000 * 2); fileRef.Dispose(); locFile.MustMatchHashOf(svrFile); await TmpDir.Cleanup(server, svrFile, client, locFile); }