public void Test_GetTours() { _tourDalMock.Setup(s => s.GetTours()).Returns(_tourList); List <IElement> tours = _tourService.GetTours(); Assert.AreEqual(3, tours.Count); }
public void GetTours_ArrayReturned() { mock.Setup(m => m.Tours.GetAll()).Returns(tours); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <Tour, TourDTO>()).CreateMapper(); TourService service = new TourService(mock.Object); //ISerialize<TourDTO> serialize = new TourSerialize(); IEnumerable <TourDTO> example = (mapper.Map <IEnumerable <Tour>, List <TourDTO> >(tours));//serialize.serializeList IEnumerable <TourDTO> data = service.GetTours(); Assert.AreEqual(data.Count(), example.Count()); }
public void GetTours_ShouldReturnAllTours() { _tourRepositoryMock.Setup(x => x.GetAll(It.IsAny <int?>(), It.IsAny <int?>())) .Returns(new List <Tour> { new Tour(), new Tour() }); _mapperMock.Setup(x => x.Map <IEnumerable <Tour>, IEnumerable <TourBL> >(It.IsAny <IEnumerable <Tour> >())) .Returns(new List <TourBL> { new TourBL(), new TourBL() }); var result = _tourService.GetTours(); Assert.AreEqual(2, result.Count()); }
private void LoadTours() { ObservableCollection <Tour> tours = new ObservableCollection <Tour>(); var tour_list = TourService.GetTours(); foreach (var v in tour_list) { tours.Add(new Tour { TourID = v.TourID, Name = v.Name, Price = v.Price, Date = v.Date }); } Tours = tours; }