public void TestUpdateAll(string userKey, string currentModel, bool isExpectedDownload) { AutoUpdate updater = new AutoUpdate(); if (userKey != null) { updater.UserKey = userKey; } updater.CurrentVersion = testVersion; bool retVal = updater.UpdateAll(); Assert.AreEqual(isExpectedDownload, retVal, "did download"); Assert.AreEqual("", updater.Message); if (!isExpectedDownload) { return; } string dllFile = dllFolder + "TickZoomEngine-" + updater.CurrentVersion + ".dll"; Assert.IsTrue(File.Exists(dllFile)); var assemblyName = AssemblyName.GetAssemblyName(dllFile); Assert.AreEqual(assemblyName.Version, new Version(testVersion)); dllFile = dllFolder + "ProviderCommon-" + updater.CurrentVersion + ".dll"; Assert.IsTrue(File.Exists(dllFile)); }
public void TestFreeUpdateAllFailure() { while (Directory.Exists(dllFolder)) { try { Directory.Delete(dllFolder, true); break; } catch (IOException) { } } AutoUpdate updater = new AutoUpdate(); updater.UserKey = ""; updater.CurrentVersion = testVersion; bool retVal = updater.UpdateAll(); Assert.IsFalse(retVal, "did download"); Assert.AreEqual("Your user key was not found. Please verify that you have a valid key.\n", updater.Message); }