public void GetByIdArticle_ShouldCallRepositoryMethod() { repositoryMock.Setup(x => x.GetByFilter <Concert>(It.IsAny <Expression <Func <Concert, bool> > >())) .Returns(new Concert { Id = Guid.Parse("0597b8a3-e404-4fff-828e-72d99d489d4c"), Name = "Name4", Price = 100, LocationId = Guid.Parse("7597b8a3-e404-4fff-828e-72d99d489d4d") }); var expectedResult = concertLogic.GetById(Guid.Parse("0597b8a3-e404-4fff-828e-72d99d489d0c")); repositoryMock.Verify(r => r.GetByFilter <Concert>(It.IsAny <Expression <Func <Concert, bool> > >()), Times.Once); }
public ActionResult <ConcertDto> GetById([FromRoute] Guid id) { if (id != null) { var concert = _concertLogic.GetById(id); if (concert == null) { return(NotFound()); } return(Ok(concert)); } return(NotFound()); }