public void InitLists() { SelectedTracks = new BindingList <Track>(NewStation.Tracks.ToList()); Places = new BindingList <Place>(PlaceService.GetAllPlaces()); AllTracks = new BindingList <Track>(TrackService.GetUnattachedTracks()); if (NewStation.IsValid()) { NewStation.Place = Places.First(x => x.Id == NewStation.Place.Id);//Necessary to init value in combo box properly } }
public void CallRepositoryMethodGetAllOnce() { // Arrange var mockedUnitOfWork = new Mock <IUnitOfWork>(); var mockedRepository = new Mock <IEfGenericRepository <Place> >(); var service = new PlaceService(mockedRepository.Object, mockedUnitOfWork.Object); // Act service.GetAllPlaces(); // Assert mockedRepository.Verify(x => x.GetAll(), Times.Once); }
public void GetAllPlaces() { // Arrange var mockedUnitOfWork = new Mock <IUnitOfWork>(); var mockedRepository = new Mock <IEfGenericRepository <Place> >(); IEnumerable <Place> expected = new List <Place>() { new Place() }; mockedRepository.Setup(x => x.GetAll()).Returns(expected); var service = new PlaceService(mockedRepository.Object, mockedUnitOfWork.Object); // Act var actual = service.GetAllPlaces(); // Assert CollectionAssert.AreEquivalent(expected, actual); }
public ActionResult <List <string> > GetAllPlaces() { string id = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; return(_placeService.GetAllPlaces(id)); }