public async Task DeleteAsync_Succes()
        {
            var service = new ArticleService(_unitOfWorkMock.Object);

            var result = await service.DeleteAsync(2, 1);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Status, ServiceResponseStatus.Success);
            Assert.AreEqual(result.Result, 2);
        }
        public async Task DeleteAsync_InvalidOperation()
        {
            var service = new ArticleService(_unitOfWorkMock.Object);

            var result = await service.DeleteAsync(1, 1);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Status, ServiceResponseStatus.InvalidOperation);
            Assert.AreEqual(result.Result, 0);
        }
        public async Task DeleteAsync_NotFound()
        {
            var service = new ArticleService(_unitOfWorkMock.Object);

            var result = await service.DeleteAsync(4, 1);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Status, ServiceResponseStatus.NotFound);
            Assert.AreEqual(result.Result, 0);
        }
Beispiel #4
0
        protected async Task DeleteArticle(Article article)
        {
            var authenticationState = await AuthenticationStateTask;

            if (authenticationState.User.Identity.Name != "Kevin")
            {
                await ArticleService.DeleteAsync(article.Id);

                Articles.Remove(article);
                StateHasChanged();
            }
        }
Beispiel #5
0
 public async Task <IActionResult> Delete(int id)
 {
     return(Ok(succeed: await _service.DeleteAsync(id), data: id));
 }
Beispiel #6
0
        public async Task <NoContentResult> Delete(int articleId)
        {
            await _articleService.DeleteAsync(articleId);

            return(NoContent());
        }