Ejemplo n.º 1
0
        private async void LoadData(string level)
        {
            try
            {
                var service  = new ContestsService(_user.Token);
                var contests = await service.GetAll();

                News = new ObservableCollection <Contest>(contests.Where(con => con.Level.Equals(level)));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 2
0
        public ContestsServiceTest()
        {
            var services = new ServiceCollection();

            services.AddEntityFramework()
            .AddInMemoryDatabase()
            .AddDbContext <BookContext>(c => c.UseInMemoryDatabase());

            var serviceProvider = services.BuildServiceProvider();

            var loggerFactory = serviceProvider.GetService <ILoggerFactory>();

            loggerFactory.AddDebug(LogLevel.Verbose);

            var dbContext = serviceProvider.GetRequiredService <BookContext>();

            CreateSampleData(dbContext);

            _service = new ContestsService(dbContext);
        }