Exemplo n.º 1
0
        public void Delete_WhenCorrectViewModelGiven_ShouldReturnJsonViewModel()
        {
            var resultId = 1;

            _mockRepo.Setup(x => x.DeleteResult(resultId)).Returns(Task.FromResult(true));

            var result = _sut.Delete(resultId).Result;

            Assert.IsNotNull(result);
            Assert.IsInstanceOf <NoContentResult>(result);
        }
Exemplo n.º 2
0
        public async Task Delete_CorrectViewModelGiven_ReturnsJsonViewModel()
        {
            var id = _fixture.Create <int>();

            _commandDispatcherMock.Setup(x => x.DispatchAsync <RemoveResultCommand>(It.IsAny <RemoveResultCommand>()))
            .Returns(Task.CompletedTask);

            var result = await _controller.Delete(id);

            Assert.IsNotNull(result);
            Assert.IsInstanceOf <NoContentResult>(result);
        }
Exemplo n.º 3
0
        private void deleteToolStripMenuItem_Delete_Click(object sender, EventArgs e)
        {
            int SelectedResults = listView_UserReports.SelectedItems.Count;

            if (SelectedResults == 0)
            {
                return;
            }

            MaterialMessageBox.MessageBoxResult result = MaterialMessageBox.MessageBoxResult.None;
            result = MaterialMessageBox.Show("Are you sure you want to delete " + SelectedResults + " selected reports?", "Easy Survey - Delete Reports", MaterialMessageBox.MessageBoxButtons.YesNo, MaterialMessageBox.MessageBoxIcon.Warning);

            IEnumerable <ListViewItem> SelectedUserReports = listView_UserReports.SelectedItems.Cast <ListViewItem>();

            if (result == MaterialMessageBox.MessageBoxResult.Yes)
            {
                using (ResultController resultController = new ResultController())
                    foreach (ListViewItem reportItem in SelectedUserReports)
                    {
                        long ResultID = Convert.ToInt64(reportItem.Tag);
                        resultController.Delete(ResultID);
                        listView_UserReports.Items.Remove(reportItem);
                    }
                RefreshReports();
            }
        }
Exemplo n.º 4
0
            public void DeleteReturnsOk()
            {
                _context.Setup(s => s.Delete(1));

                var response = controller.Delete(1);

                _context.Verify(m => m.Delete(1));

                Assert.IsTrue(response.IsSuccessStatusCode);
            }