Example #1
0
        public async void Get_returns_list_of_trainings()
        {
            //Arrange
            var sampleTraining1 = new Training()
            {
                Id = 1, StartDate = new DateTime(2019, 09, 20), EndDate = new DateTime(2019, 09, 21), TrainingName = "Asp.net Training"
            };
            var sampleTraining2 = new Training()
            {
                Id = 2, StartDate = new DateTime(2019, 09, 21), EndDate = new DateTime(2019, 09, 22), TrainingName = "Web Api training"
            };

            context.AddRange(sampleTraining1, sampleTraining2);
            context.SaveChanges();

            //Act
            var taskResult = await myController.GetTrainings();

            //Assert
            Assert.IsType <ActionResult <IEnumerable <Training> > >(taskResult);
        }