Exemple #1
0
        public AirhostessesViewModel(INavigationService navigationService)
        {
            airportConnector       = new AirportConnector("https://localhost:5001/api/");
            this.navigationService = navigationService;

            CreateAirhostess = new RelayCommand(Create);
            DeleteAirhostess = new RelayCommand(Delete);
            UpdateAirhostess = new RelayCommand(Update);

            NewAirhostess = new Airhostess();
            Airhostesses  = new ObservableCollection <Airhostess>();

            LoadData().ConfigureAwait(false);
        }
        public async void GetAllAirportsReturnNotNull()
        {
            ICachingService cache = new CachingService();

            DbContextOptions <AirportDbContext> options = new DbContextOptionsBuilder <AirportDbContext>().
                                                          UseSqlServer("data source=.;initial catalog=test_Local;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;")
                                                          .Options;

            AirportDbContext   context           = new AirportDbContext(options);
            IAirportRepository airportRepository = new AirportRepository(context);
            IAirportConnector  airport           = new AirportConnector(cache, airportRepository);


            var airports = await airport.GetAllAirports();

            Assert.NotNull(airports);
        }
        public async void GetAllAirportsCount()
        {
            ICachingService cache = new CachingService();

            DbContextOptions <AirportDbContext> options = new DbContextOptionsBuilder <AirportDbContext>().
                                                          UseSqlServer("data source=.;initial catalog=test_Local;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;")
                                                          .Options;

            AirportDbContext   context           = new AirportDbContext(options);
            IAirportRepository airportRepository = new AirportRepository(context);
            IAirportConnector  airport           = new AirportConnector(cache, airportRepository);

            int expectedValue = 1062;

            var airports = await airport.GetAllAirports();

            int actualValue = airports.Airports.ToList().Count();

            Assert.Equal(expectedValue, actualValue);
        }