Exemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            var training1 = new Training
            {
                Label       = "Test",
                Price       = 50,
                IsSubtitled = true,
                IsActive    = true
            };
            await dataService.AddTraining(training1);

            var training = await dataService.GetAllTraining();

            return(View(training));
        }
Exemplo n.º 2
0
        public async Task GetAllTrainigAsync()
        {
            var training1 = RandomTraining(true);
            var training2 = RandomTraining(true);

            using (var context = new DatabaseContext(options))
            {
                context.Add(training1);
                context.Add(training2);
                context.SaveChanges();
            }
            using (var ds = new TrainingDataService(options))
            {
                var trainings = await ds.GetAllTraining();

                Assert.AreEqual(2, trainings.Count());
            }
        }