public void GetAllUsers_WithoutParameters_RetursAllUsers() { // Arrange var mock = new Mock <IUnitOfWork>(); mock.Setup(unitOfWork => unitOfWork.TourRepository.GetAll()).Returns(GetAllTours); var tourService = new TourService(mock.Object); // Act var actualTours = tourService.GetAllTours(); // Assertions Assert.True(actualTours.Count == 2); Assert.Equal(1, actualTours[0].TourId); Assert.Equal(2, actualTours[1].TourId); Assert.Equal(1, actualTours[0].Price); Assert.Equal("Tour2", actualTours[1].Name); }
public IActionResult List() { ViewBag.TourList = _tourService.GetAllTours().ToList(); return(View()); }