public async Task ApplicationUpdatePresenter_DownloadClicked_ShowsMessageBoxWhenDownloadFails()
        {
            // Arrange
            using (var artifacts = new ArtifactFolder())
            {
                var updateFile = new ApplicationUpdateFile {
                    Description = "Foo", Name = "Foo.zip", HttpAddress = @"C:\DoesNotExist\Foo.zip"
                };
                var update = new ApplicationUpdate
                {
                    UpdateFiles = new List <ApplicationUpdateFile> {
                        updateFile
                    }
                };
                var model = new ApplicationUpdateModel(update);
                model.SelectedUpdateFile = update.UpdateFiles.First();

                var messageBox = new MockMessageBoxPresenter();
                using (var presenter = new MockDialogApplicationUpdatePresenter(model, messageBox))
                {
                    presenter.ShowDialog(null);
                    Assert.IsTrue(presenter.MockDialog.Shown);
                    // Act
                    var saveFile = new MockFileDialogPresenterReturnsFileName(_ => DialogResult.OK, artifacts.GetRandomFilePath());
                    await presenter.DownloadClick(saveFile);

                    // Assert
                    Assert.AreEqual(1, messageBox.Invocations.Count);
                    Assert.IsTrue(presenter.MockDialog.Shown);
                    Assert.AreEqual(1, saveFile.Invocations.Count);
                }
            }
        }
        private static ApplicationUpdateModel CreateUpdateModel(string sourceFile, ApplicationUpdateFileType updateType)
        {
            File.WriteAllText(sourceFile, "FoobarFizzbizz");

            string sourceFileName = Path.GetFileName(sourceFile);
            var    updateFile     = new ApplicationUpdateFile {
                Description = "Foo", Name = sourceFileName, HttpAddress = sourceFile, Size = (int)new FileInfo(sourceFile).Length, UpdateType = (int)updateType
            };
            var update = new ApplicationUpdate
            {
                UpdateFiles = new List <ApplicationUpdateFile> {
                    updateFile
                }
            };

            return(new ApplicationUpdateModel(update));
        }