예제 #1
0
 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
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public ActionResult <List <string> > GetAllPlaces()
        {
            string id = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;

            return(_placeService.GetAllPlaces(id));
        }