protected BaseExamControllerTests(List <ExamResult> examResults)
 {
     _examResults      = examResults;
     _mockLogger       = new Mock <ILogger <ExamResultsController> >();
     _mockExamsService = new Mock <IExamResultsService>();
     _mockExamsService.Setup(svc => svc.GetExamResults()).Returns(_examResults);
     _examResultsController = new ExamResultsController(_mockExamsService.Object, _mockLogger.Object);
 }
        public async Task GetExamResults_Return_Empty_Results()
        {
            // Arrange
            var logger         = new Mock <ILogger <ExamResultsController> >();
            var examAPIService = new Mock <IExamAPIService>();

            examAPIService.Setup(p => p.GetExamResults())
            .Returns(Task.FromResult(new List <ExamSubject>()));

            resultsController = new ExamResultsController(logger.Object, examAPIService.Object);

            // Act
            var results = await resultsController.Get();

            // Assert
            Assert.IsTrue(results.Count() == 0);
        }
        public void Setup()
        {
            List <ExamSubject> examSubjects = new List <ExamSubject>
            {
                new ExamSubject()
                {
                    Subject = "A Test Subject One",
                    Results = new List <Results>
                    {
                        new Results()
                        {
                            Grade = GradeType.Fail,
                            Year  = 2019
                        },
                        new Results()
                        {
                            Grade = GradeType.Pass,
                            Year  = 2020
                        }
                    }
                },
                new ExamSubject()
                {
                    Subject = "B Test Subject Two",
                    Results = new List <Results>
                    {
                        new Results()
                        {
                            Grade = GradeType.Pass,
                            Year  = 2019
                        }
                    }
                }
            };

            var logger         = new Mock <ILogger <ExamResultsController> >();
            var examAPIService = new Mock <IExamAPIService>();

            examAPIService.Setup(p => p.GetExamResults())
            .Returns(Task.FromResult(examSubjects));

            resultsController = new ExamResultsController(logger.Object, examAPIService.Object);
        }