public void Snack_Service_Should_Get_Snack_By_Id_Sucessfully()
        {
            //Arrange
            var snack = ObjectMother.GetDefaultSnack();

            _mockSnackRepository.Setup(r => r.GetById(snack.Id)).Returns(snack);

            //Action
            var returnedSnack = _snackService.GetById(snack.Id);

            //Assert
            _mockSnackRepository.Verify(r => r.GetById(snack.Id), Times.Once);
            returnedSnack.Should().NotBeNull();
            returnedSnack.Id.Should().Be(snack.Id);
        }
Beispiel #2
0
 public IHttpActionResult GetById(int id)
 {
     return(HandleQuery <Snack, SnackViewModel>(_service.GetById(id)));
 }