예제 #1
0
        public void AddArticle_ShouldCallRepositoryMethod()
        {
            var concert = new ConcertDto
            {
                Id         = Guid.Parse("0597b8a3-e404-4fff-828e-72d99d489d4c"),
                Name       = "Name4",
                Price      = 100,
                LocationId = Guid.Parse("7597b8a3-e404-4fff-828e-72d99d489d4d")
            };

            repositoryMock.Setup(x => x.Insert <Concert>(It.IsAny <Concert>()));

            var expectedResult = concertLogic.AddConcert(concert);

            repositoryMock.Verify(r => r.Insert <Concert>(It.IsAny <Concert>()), Times.Once);
        }
예제 #2
0
        public ActionResult <ConcertDto> AddConcert(ConcertDto concertDto)
        {
            _concertLogic.AddConcert(concertDto);

            if (!ModelState.IsValid)
            {
                return(new BadRequestObjectResult(ModelState));
            }

            return(Ok(concertDto));
        }