Esempio n. 1
0
        public async Task <ActionResult> Delete(string id, CancellationToken cancellationToken)
        {
            var pet = await _newsManagementService.GetNews(id, CurrentCookiesToken, cancellationToken);

            if (pet != null)
            {
                await _newsManagementService.DeleteNews(pet, CurrentCookiesToken, cancellationToken);
            }

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public async void NewsFunctionalityTest()
        {
            _token = await _accountManagementService.SignIn(TestingObjectProvider.Instance.Login);

            Assert.NotNull(_token);

            var news = TestingObjectProvider.Instance.News;

            Assert.NotNull(await _newsManagementService.GetAllNews(_token.Jwt));
            Assert.NotNull(await _newsManagementService.GetNews(news.Id, _token.Jwt));
            Assert.True(await _newsManagementService.CreateNews(news, _token.Jwt));
            Assert.True(await _newsManagementService.DeleteNews(news, _token.Jwt));

            var exception = Record.Exception(() => _newsManagementService.UpdateNews(null, _token.Jwt).Result);

            Assert.IsType(typeof(NullReferenceException), exception?.InnerException);

            Assert.False(await _newsManagementService.CreateNews(null, _token.Jwt));
        }
Esempio n. 3
0
 public async void TestOfDeletingSpecifiedNews()
 {
     Assert.True(await _newsManagementService.DeleteNews(_testingNews, _token.Jwt));
 }