private bool AudioCanBePlayedBeforeAnswer(AnswerTypeEnum answerType) { if (Mode == ModeEnum.Spelling || (AppSettings.Learning.PlayPronuncation.BeforeAnswer && answerType == AnswerTypeEnum.Translations)) { return(true); } return(false); }
private bool AudioCanBePlayedAfterAnswer(AnswerTypeEnum answerType) { if (Mode != ModeEnum.Spelling && AppSettings.Learning.PlayPronuncation.AfterAnswer && answerType == AnswerTypeEnum.Words) { return(true); } return(false); }
public QuestionInfo( Entry entry, QuestionTypeEnum questionType, AnswerTypeEnum answerType, List <string>?possibleAnswers) { Entry = entry; QuestionType = questionType; AnswerType = answerType; PossibleAnswers = possibleAnswers; }
public void CompareQuestionInfo_EqualObjects_ReturnsTrue( Entry entry, QuestionTypeEnum questionType, AnswerTypeEnum modeType, List <string>?possibleAnswers1, List <string>?possibleAnswers2) { // Arrange var questionInfo1 = new QuestionInfo(entry, questionType, modeType, possibleAnswers1); var questionInfo2 = new QuestionInfo(entry, questionType, modeType, possibleAnswers2); // Act bool result = questionInfo1.Equals(questionInfo2); // Assert Assert.True(result); }
public string GetDetail(CSVExportData.VoterAnswersRow detail, AnswerTypeEnum answerType) { switch (ddlAnswer.SelectedValue) { case "Answer": return answerType == AnswerTypeEnum.SelectionTextType ? (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText) : (detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText); case "AnswerDisplayOrderNumber": if (isTextAnswer(detail.AnswerTypeId)) return detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText; else return answerType == AnswerTypeEnum.SelectionOtherType ? (detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText) : detail.AnswerDisplayOrder.ToString(); case "AnswerID": if (isTextAnswer(detail.IsAnswerTypeIdNull()?0:detail.AnswerTypeId)) return detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText; else return answerType == AnswerTypeEnum.SelectionTextType ? (detail.IsAnswerIdAliasNull() ? (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText) : detail.AnswerIdAlias) : (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText); case "AnswerAlias": if (isTextAnswer(detail.AnswerTypeId)) return detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText; else return answerType == AnswerTypeEnum.SelectionTextType ? (detail.IsAnswerAliasNull() ? (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText) : detail.AnswerAlias) : (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText); case "AnswerIdAlias": if (isTextAnswer(detail.AnswerTypeId)) return detail.IsAnswerTextNull() ? string.Empty : detail.AnswerText; else return answerType == AnswerTypeEnum.SelectionTextType ? (detail.IsAnswerIdAliasNull() ? detail.AnswerAnswerText : detail.AnswerIdAlias) + " " + (detail.IsAnswerAliasNull() ? string.Empty : detail.AnswerAlias) : (detail.IsAnswerAnswerTextNull() ? string.Empty : detail.AnswerAnswerText); default: return "Invalid DDl Value"; } }
private void PlayPronunciationAudio(List <string> words, WhenEnum whenWasInvoked, AnswerTypeEnum answerType) { if (whenWasInvoked == WhenEnum.BeforeAnswer && !AudioCanBePlayedBeforeAnswer(answerType)) { return; } if (whenWasInvoked == WhenEnum.AfterAnswer && !AudioCanBePlayedAfterAnswer(answerType)) { return; } if (AppSettings.PronunciationApi == null) { return; } _ = PronunciationService.PlayAsync(words.ToList()) .ContinueWith( x => PronunciationLogger.LogError( x.Exception, "An unexpected error occured in pronunciation service." ), TaskContinuationOptions.OnlyOnFaulted ); }