Exemple #1
0
        public void GetReturnsNotFound()
        {
            // Arrange
            var _helloWordController = new HelloWordController(_helloWordRepository.Object);

            // Act
            var actionResult = _helloWordController.GetHelloWord();

            // Assert
            Assert.IsInstanceOf <NotFoundResult>(actionResult);
        }
Exemple #2
0
        public void GetHelloWord_success()
        {
            // Arrange
            var word = new GetHelloWordResponse {
                Id = 1, Word = "Hello Word"
            };

            _helloWordRepository.Setup(x => x.GetHelloWord())
            .Returns(word);

            _helloWordController = new HelloWordController(_helloWordRepository.Object);

            var actionResult  = _helloWordController.GetHelloWord();
            var contentResult = actionResult as OkNegotiatedContentResult <GetHelloWordResponse>;

            // Assert
            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
            Assert.AreEqual(contentResult.Content.Word, word.Word);
        }