public void Snack_Service_Should_Get_All_Snacks_Sucessfully() { //Arrange var snack = ObjectMother.GetDefaultSnack(); var mockValueRepository = new List <Snack>() { snack }.AsQueryable(); _mockSnackRepository.Setup(r => r.GetAll()).Returns(mockValueRepository); //Action var snacks = _snackService.GetAll(); //Assert _mockSnackRepository.Verify(r => r.GetAll(), Times.Once); snacks.Should().NotBeNull(); snacks.First().Should().Be(snack); snacks.Count().Should().Be(mockValueRepository.Count()); }
public IHttpActionResult Get(ODataQueryOptions <Snack> queryOptions) { return(HandleQueryable <Snack, SnackGridViewModel>(_service.GetAll(), queryOptions)); }