public async Task UpdateMachineMRUWithNoChangeRemoteMRUList() { // If something happens that causes an update to a remote MRU, we should // not generate a change to the rest of the world. // Write out an MRU list to a machine, and start up everything. GenerateOtherMachineMRU("MACHINE2", 10); int count = 0; MRUListUpdateStream.GetMRUListStream() .Subscribe(_ => count++); await TestUtils.SpinWaitAreEqual(1, () => count); // Now, redo the update for machine 2, so we write the same data back. // Wait, and see what happens. var mrus = MRUSettingsCache.GetFromMachine("MACHINE2"); MRUSettingsCache.UpdateForMachine("MACHINE2", mrus); await TestUtils.SpinWait(() => count != 1, 500, false); Assert.AreEqual(1, count); // Write it to a new machine MRUSettingsCache.UpdateForMachine("MACHINE1", mrus); await TestUtils.SpinWait(() => count != 1, 500, false); Assert.AreEqual(1, count); }
public void NewDoesNotDeleteOld() { var mrus = GenerateMRUs(5); MRUSettingsCache.UpdateForMachine("MACHINE1", mrus); MRUSettingsCache.UpdateForMachine("MACHINE2", mrus); var rtn = MRUSettingsCache.GetFromMachine("MACHINE1"); Assert.AreEqual(5, rtn.Length); }
public void UpdateSpecificCache() { var mrus = GenerateMRUs(5, 0); MRUSettingsCache.UpdateForMachine("MACHINE1", mrus); mrus = GenerateMRUs(10, 100); MRUSettingsCache.UpdateForMachine("MACHINE1", mrus); var rtn = MRUSettingsCache.GetFromMachine("MACHINE1"); Assert.AreEqual(10, rtn.Length); Assert.AreEqual(100, rtn[0].Id); }
public void SetSpecificCache() { var mrus = GenerateMRUs(); MRUSettingsCache.UpdateForMachine("MACHINE1", mrus); var rtn = MRUSettingsCache.GetFromMachine("MACHINE1"); Assert.AreEqual(mrus.Length, rtn.Length); foreach (var dual in mrus.Zip(rtn, (m, r) => Tuple.Create(m, r))) { Assert.AreEqual(dual.Item1.Id, dual.Item2.Id); Assert.AreEqual(dual.Item1.IDRef, dual.Item2.IDRef); Assert.AreEqual(dual.Item1.LastLookedAt, dual.Item2.LastLookedAt); Assert.AreEqual(dual.Item1.StartTime, dual.Item2.StartTime); Assert.AreEqual(dual.Item1.Title, dual.Item2.Title); } }
public async Task MachineFileWritten() { // Write out to a local machine file. MRUListUpdateStream.MachineName = "ThisTestMachine"; // Prime and get the system up and running var dummyCache = await GetFirstMRUList(); // Load in 10, see if they were cached correctly. await LoadDB(10); await TestUtils.SpinWait(() => MRUSettingsCache.GetFromMachine("ThisTestMachine") != null, 1000); var mrus = MRUSettingsCache.GetFromMachine("ThisTestMachine"); Assert.IsNotNull(mrus); Assert.AreEqual(10, mrus.Length); }
public void GetBackSpecificCacheEmpty() { var mrus = MRUSettingsCache.GetFromMachine("MACHINE1"); Assert.IsNull(mrus); }