Example #1
0
        public void GetReturnsErrorMessage()
        {
            var id = string.Empty;

            var mockBeerProvide = new Moq.Mock <IBeerProvider>();

            var controller = new BeerController(mockBeerProvide.Object);

            IHttpActionResult actionResult = controller.GetBeer(id);

            Assert.IsNotNull(actionResult);
            Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult));
        }
Example #2
0
        public void GetBeerReturnResult(string id)
        {
            var mockBeerModel = new Beer();

            var mockBeerProvide = new Moq.Mock <IBeerProvider>();

            var controller = new BeerController(mockBeerProvide.Object);

            mockBeerProvide.Setup(x => x.GetBeer(id)).Returns(mockBeerModel);
            //Act
            IHttpActionResult actionResult = controller.GetBeer(id);

            //Assert
            Assert.IsNotNull(actionResult);
            Assert.IsInstanceOfType(actionResult, typeof(OkNegotiatedContentResult <Beer>));
        }