public async Task GetQuestions_WithNoRelevantResults_ReturnsEmptyResponse() { // Arrange _questionsRepositoryMock .Setup(x => x.GetQuestions(It.IsAny <GetQuestionsQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new QueryResult <Question>(0, 0, 5, new Question[0])); // Act var results = await _service.GetQuestions(new GetQuestionsRequest(), CancellationToken.None); // Assert Assert.IsEmpty(results.Items); Assert.AreEqual(0, results.TotalCount); }
public void ReturnsTheRequiredAmountOfQuestions() { var amount = 3; var questions = _service.GetQuestions(amount); Assert.AreEqual(amount, questions.Length); }
public TestsViewModel() { Questions = _questionsService.GetQuestions(10); CheckResultsCommand = new RelayCommand(() => { Result = _questionsService.CheckResult(Questions); }); }
// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { try { Settings.LoadSettings(); QuestionsList = QuestionsService.GetQuestions(); } catch (Exception exp) { MessageBox.Show("Κάτι δεν πήγε καλά ... Εργαζόμαστε γι αυτό....." + exp.Message); } }
public IActionResult Index() { return(View(_questionsService.GetQuestions())); }
public IEnumerable <QuestionDto> GetQuestions() { return(_service.GetQuestions()); }
public IActionResult GetQuestions() { var test = _questionsService.GetQuestions(); return(View(test)); }
static void Main(string[] args) { Console.WriteLine("Welcome!"); while (true) { int maxAttempts = 0; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("Quiz App"); Console.ResetColor(); Console.WriteLine("1.Student\n2.Teacher"); int login = _helperService.ValidatePositiveNumber(Console.ReadLine(), 2); if (login == 1) { Console.Clear(); StudentStart: Console.WriteLine("Enter Username"); string username = Console.ReadLine(); Console.WriteLine("Enter Password"); string password = Console.ReadLine(); loggedStudent = _studentServices.LogIn(username, password); if (loggedStudent == null) { _helperService.ErrorMessage("Wrong username or password!"); maxAttempts++; if (maxAttempts >= 3) { break; } Console.ReadLine(); Console.Clear(); goto StudentStart; } else if (loggedStudent.AnsweredQuestions == true) { Console.Clear(); Console.WriteLine("You did the test!"); goto StudentStart; } else { _studentServices.WelcomeStudent(username); _questionsService.GetQuestions(loggedStudent); } } else if (login == 2) { Console.Clear(); TeacherStart: Console.WriteLine("Enter Username"); string username = Console.ReadLine(); Console.WriteLine("Enter Password"); string password = Console.ReadLine(); loggedTeacher = _teacherServices.Login(username, password); if (loggedTeacher == null) { _helperService.ErrorMessage("Wrong username or password!"); maxAttempts++; if (maxAttempts >= 3) { break; } Console.ReadLine(); Console.Clear(); goto TeacherStart; } else { Console.Clear(); _teacherServices.WelcomeTeacher(username); Console.WriteLine("Press 1 to show Students that did the quiz and have a grade"); int showStudents = Convert.ToInt32(Console.ReadLine()); if (showStudents == 1) { _studentServices.PrintStudents(); Console.WriteLine(); } } } else { continue; } } Console.ReadLine(); }
public ActionResult <IEnumerable <Question> > Get() { return(Ok(_qs.GetQuestions())); }