public void CallGetArticleByIdOnce() { // Arrange var mockedMappingService = new Mock <IMappingService>(); var mockedArticleService = new Mock <IArticleService>(); var articleId = Guid.NewGuid(); Article article = new Article() { Title = "title", Id = articleId, Subheader = "subheader", Content = "conteeent" }; ArticleByIdViewModel viewModel = new ArticleByIdViewModel() { Title = "title", Id = articleId.ToString(), Subheader = "subheader", Content = "conteeent" }; mockedArticleService.Setup(x => x.GetArticleById(articleId.ToString())).Returns(article); mockedMappingService.Setup(x => x.Map <Article, ArticleByIdViewModel>(It.IsAny <Article>())).Returns(viewModel); var controller = new ArticleController(mockedMappingService.Object, mockedArticleService.Object); // Act controller.ById(viewModel.Id); // Assert mockedArticleService.Verify(x => x.GetArticleById(It.IsAny <string>()), Times.Once); }