public void DownloadLatestVersion_WhenApkIsDownloaded_CallApkInstall() { _githubRelease.TagName = _newerTag; var updateSupportMock = new Mock <IUpdateSupport>(); var downloadManagerMock = new Mock <IDownloadManager>(); updateSupportMock.Setup(us => us.CheckIfApkIsDownloaded()).Returns(true); updateSupportMock.Setup(us => us.ApkInstall()).Verifiable(); downloadManagerMock.Setup(dm => dm.Start(It.IsAny <IDownloadFile>(), true)).Verifiable(); AppUpdater testAppUpdater = new AppUpdater(updateSupportMock.Object, downloadManagerMock.Object); testAppUpdater.UpdateApp(_githubRelease); updateSupportMock.Verify(us => us.ApkInstall()); downloadManagerMock.Verify(dm => dm.Start(It.IsAny <IDownloadFile>(), true), Times.Never); }
public void DownloadLatestVersion_WhenApkIsNotDownloaded_CallDownloadUpdateApp() { //Todo: Przetestować update-owanie appki na realnym telefonie/symulatorze _githubRelease.TagName = _newerTag; var updateSupportMock = new Mock <IUpdateSupport>(); var downloadManagerMock = new Mock <IDownloadManager>(); updateSupportMock.Setup(us => us.CheckIfApkIsDownloaded()).Returns(false); downloadManagerMock.Setup(dm => dm.Start(It.IsAny <IDownloadFile>(), true)).Verifiable(); downloadManagerMock.SetupAdd(dm => dm.CollectionChanged += It.IsAny <NotifyCollectionChangedEventHandler>()) .Verifiable(); AppUpdater testAppUpdater = new AppUpdater(updateSupportMock.Object, downloadManagerMock.Object); testAppUpdater.UpdateApp(_githubRelease); downloadManagerMock.Verify(dm => dm.Start(It.IsAny <IDownloadFile>(), true)); downloadManagerMock.VerifyAdd(dm => dm.CollectionChanged += It.IsAny <NotifyCollectionChangedEventHandler>()); downloadManagerMock.SetupRemove(dm => dm.CollectionChanged -= It.IsAny <NotifyCollectionChangedEventHandler>()); }
private async void Application_Startup(object sender, StartupEventArgs e) { if (!Debugger.IsAttached) { var updater = new AppUpdater(); await updater.UpdateApp(); } PWCore.Create(); PWCore.CurrentCore .RegisterTypes() .CreateCoreBuilder() .UseCulture <CultureBuilder>() .UseLogin <LoginHandler>() .UseUI <UIBuilder>() .MainWindow <MainWindow>() .MainViewModel <MainViewModel>() .BuildCore() .RunWpf(); }