示例#1
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));
        }
示例#2
0
 public async Task <ActionResult> Edit(string id, CancellationToken cancellationToken)
 {
     return(PartialView("Edit", await _newsManagementService.GetNews(id, CurrentCookiesToken, cancellationToken)));
 }
示例#3
0
 public async void TestOfGettingSpecifiedNews()
 {
     Assert.NotNull(await _newsManagementService.GetNews(_testingNews.Id, _token.Jwt));
 }