예제 #1
0
        public async Task Test_LoadFromCitiesCorrectly()
        {
            //arrange
            CityDataService mockCityDataService   = ServiceMocks.GetMockCityDataService(3);
            var             mockMessenger         = new Mock <IMvxMessenger>();
            var             mockConnectionService = new Mock <IConnectionService>();
            var             mockDialogService     = new Mock <IDialogService>();

            //act
            var searchJourneyViewModel = new SearchJourneyViewModel(mockMessenger.Object, mockCityDataService, mockConnectionService.Object, mockDialogService.Object);
            await searchJourneyViewModel.LoadCities();

            //assert
            Assert.AreEqual(searchJourneyViewModel.FromCities.Count, 3);
        }
예제 #2
0
        public async Task Test_Initialize()
        {
            //arrange
            CityDataService mockCityDataService   = ServiceMocks.GetMockCityDataService(3);
            var             mockMessenger         = new Mock <IMvxMessenger>();
            var             mockConnectionService = new Mock <IConnectionService>();

            var a = mockConnectionService.Setup(m => m.CheckOnline()).Returns(true);

            var mockDialogService = new Mock <IDialogService>();

            //act
            var searchJourneyViewModel = new FakeSearchJourneyViewModel(mockMessenger.Object, mockCityDataService, mockConnectionService.Object, mockDialogService.Object);
            await searchJourneyViewModel.InitializeAsync();

            //assert
            Assert.IsNotNull(searchJourneyViewModel.FromCities);
            Assert.IsNotNull(searchJourneyViewModel.ToCities);
            Assert.IsNotNull(searchJourneyViewModel.SelectedFromCity);
            Assert.IsNotNull(searchJourneyViewModel.SelectedToCity);
            Assert.IsNotNull(searchJourneyViewModel.SelectedHour);
        }
예제 #3
0
 public void Initialize()
 {
     cityDataService = ServiceMocks.GetMockCityDataService(3);
 }