Example #1
0
        public async Task CheckAvailabilityAsync_ServerNotAvailable_ReturnErrorString()
        {
            var articleHttpClientMock = new Mock <IArticleHttpClient>();

            articleHttpClientMock.Setup(x => x.IsAvailableAsync()).ReturnsAsync(false);
            var articleService = new ArticleService(articleHttpClientMock.Object);

            var result = await articleService.CheckAvailabilityAsync();

            Assert.AreEqual("Service is not available. Please contact to administrator.", result);
        }
Example #2
0
        public async Task CheckAvailabilityAsync_ServerAvailable_ReturnSuccessString()
        {
            var articleHttpClientMock = new Mock <IArticleHttpClient>();

            articleHttpClientMock.Setup(x => x.IsAvailableAsync()).ReturnsAsync(true);
            var articleService = new ArticleService(articleHttpClientMock.Object);

            var result = await articleService.CheckAvailabilityAsync();

            Assert.AreEqual("Service is available.", result);
        }