public void Contest_Add_ShouldBeOk() { //Cenário _mockContestRepository.Setup(rp => rp.Save(_contest)).Returns(_contest); //Ação Contest savedContest = _contestService.Add(_contest); //Verificar savedContest.Should().Be(_contest); _mockContestRepository.Verify(rp => rp.Save(_contest)); }
// POST api/Contests public ContestDto Post([FromBody] ContestDto contest) { var newContest = contest.ConvertFromDto(); ContestService.Add(newContest); return(newContest.ConvertToDto()); }