public async Task Delete(int Id)
        {
            var entityToDelete = (await NewsArticleService.GetByFilter(x => x.Id == Id)).FirstOrDefault();

            if (entityToDelete != null)
            {
                await NewsArticleService.Delete(entityToDelete);
            }
            else
            {
                Response.StatusCode = StatusCodes.Status404NotFound;
            }
        }
예제 #2
0
        public async Task ShouldAddNewsArticle()
        {
            await addTwitterUser();

            var TestObject = new NewsArticle {
                Source = "testUrl", CredibilityScore = 69, UserId = userId
            };

            await newsArticleService.Add(TestObject);

            var result = await newsArticleService.GetByFilter(x => x.Source == TestObject.Source);

            Assert.NotNull(result);
        }