Example #1
0
        private async void SubmitComments()
        {
            if (!_viewModel.HasComments())
            {
                MessageBoxHelper.ShowError(this, "You haven't commented on anything yet.");
                return;
            }
            var confirmation = "Are you sure to submit?";

            if (_viewModel.IsMerged || _viewModel.IsClosed)
            {
                confirmation = "!!!The Pull Request was merged/closed.!!!" + confirmation;
            }
            var choice = MessageBoxHelper.ShowConfirmation(this, confirmation);

            if (choice != MessageBoxResult.Yes)
            {
                return;
            }

            try
            {
                await _viewModel.SubmitComments();
            }
            catch (Exception exception)
            {
                MessageBoxHelper.ShowError(this, "Unable to comment.\r\n\r\n" + exception);
            }
        }
Example #2
0
        public async void TestHasComments()
        {
            await _mainWindowVm.RetrieveDiffs();

            // reset.
            foreach (var diff in _mainWindowVm.Diffs)
            {
                diff.Comments = "";
            }
            _mainWindowVm.GeneralComments = "";

            Assert.False(_mainWindowVm.HasComments());

            _mainWindowVm.Diffs.First().Comments = "my comment on file";
            Assert.True(_mainWindowVm.HasComments());

            _mainWindowVm.Diffs.First().Comments = null;
            Assert.False(_mainWindowVm.HasComments());

            _mainWindowVm.Diffs.First().Comments = "";
            Assert.False(_mainWindowVm.HasComments());

            _mainWindowVm.GeneralComments = "my general comments";
            Assert.True(_mainWindowVm.HasComments());

            _mainWindowVm.GeneralComments = null;
            Assert.False(_mainWindowVm.HasComments());

            _mainWindowVm.GeneralComments = "";
            Assert.False(_mainWindowVm.HasComments());
        }