コード例 #1
0
 public void ThrowArgumentNull_If_Source_Is_Empty()
 {
     Task.Run(() =>
     {
         Assert.ThrowsException <ArgumentNullException>(async() => await _copier.CopyAsync(_source, _destination));
     });
 }
コード例 #2
0
        private async void btnStartCopy_Click(object sender, EventArgs e)
        {
            _DisableButtons();
            copyProgressBar.Style = ProgressBarStyle.Marquee;

            try
            {
                _logger.Info($"Copying from source: {txtSourcePath.Text} :: destination: {txtDestinationPath.Text}");

                await _copierInstance.CopyAsync(txtSourcePath.Text, txtDestinationPath.Text);

                _logger.Info($"Completed");

                MessageBox.Show(this, "Completed!", "CopyDirectory", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                _logger.Debug(ex);
                MessageBox.Show(this, ex.Message, "CopyDirectory", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            copyProgressBar.Style = ProgressBarStyle.Continuous;

            _EnableButtons();
        }