Added research on the web to the BeyondFacts Lab (#1186)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-10 18:17:44 +01:00
1 parent e5c0931a60
commit 9a676101f7
66 files changed
+3609 -70

No files matched your search

@@ -20,7 +20,7 @@ public sealed class BflMarkdownSectionsTests
"KNOWLEDGE/ESTABLISHED", "KNOWLEDGE/UNCERTAINTIES", "KNOWLEDGE/WEAK_POINTS", "KNOWLEDGE/CONTROVERSIES", "KNOWLEDGE/EXPERTISE_LIMITS", "KNOWLEDGE/KEY_MESSAGES", "KNOWLEDGE/OPEN_POINTS",
"GOALS_AND_ROLE/GOAL", "GOALS_AND_ROLE/ROLE", "GOALS_AND_ROLE/REASONS", "GOALS_AND_ROLE/CONSEQUENCES", "GOALS_AND_ROLE/OPEN_POINTS",
"VALUES_AND_PERSPECTIVES/VALUES", "VALUES_AND_PERSPECTIVES/VALUE_CONFLICTS", "VALUES_AND_PERSPECTIVES/PERSONAL_INVOLVEMENT", "VALUES_AND_PERSPECTIVES/PERSPECTIVES", "VALUES_AND_PERSPECTIVES/CONSEQUENCES", "VALUES_AND_PERSPECTIVES/OPEN_POINTS",
"STRATEGY/KEY_MESSAGES", "STRATEGY/STRUCTURE", "STRATEGY/LANGUAGE", "STRATEGY/UNCERTAINTY", "STRATEGY/FRAMING", "STRATEGY/COUNTERARGUMENTS", "STRATEGY/WORRIES", "STRATEGY/OPEN_POINTS",
"STRATEGY/KEY_MESSAGES", "STRATEGY/STRUCTURE", "STRATEGY/LANGUAGE", "STRATEGY/UNCERTAINTY", "STRATEGY/FRAMING", "STRATEGY/PARTICIPANTS", "STRATEGY/COUNTERARGUMENTS", "STRATEGY/WORRIES", "STRATEGY/OPEN_POINTS",
"TEST_SITUATION/STRENGTHS", "TEST_SITUATION/PRACTICE", "TEST_SITUATION/HARD_QUESTIONS", "TEST_SITUATION/POSITION", "TEST_SITUATION/OPEN_POINTS",
"RESULTS/CHANGED", "RESULTS/KEPT", "RESULTS/LEFT_OPEN", "RESULTS/NEXT_STEPS",
}));
@@ -199,18 +199,59 @@ public sealed class BflMarkdownSectionsTests
}
[Test]
public void OnlyEmptyTextFieldsWhichAreNotPersonalGetSuggestions()
public void OnlyEmptyFieldsWithATextOrASingleChoiceWhichAreNotPersonalGetSuggestions()
{
var goals = BflMarkdownSections.SuggestableFields(BflStep.GOALS_AND_ROLE, new BflStepFormData()).Select(field => field.Id);
var values = BflMarkdownSections.SuggestableFields(BflStep.VALUES_AND_PERSPECTIVES, new BflStepFormData()).Select(field => field.Id);
var test = BflMarkdownSections.SuggestableFields(BflStep.TEST_SITUATION, new BflStepFormData()).Select(field => field.Id);
using (Assert.EnterMultipleScope())
{
Assert.That(goals, Is.EqualTo(new[] { BflFieldCatalog.GOALS }), "A field with several choices gets no suggestion.");
Assert.That(values, Is.EqualTo(new[] { BflFieldCatalog.VALUES_AND_CONCERNS, BflFieldCatalog.OTHER_PERSPECTIVES }));
Assert.That(test, Is.EqualTo(new[] { BflFieldCatalog.TEST_NOTES }));
Assert.That(test, Is.EqualTo(new[] { BflFieldCatalog.QUESTION_TYPE, BflFieldCatalog.DIFFICULTY, BflFieldCatalog.TEST_NOTES }));
}
}
[Test]
public void ASuggestionForAChoiceNamesItsOptionByLabelOrIdAndKeepsTheId()
{
var label = BflFieldCatalog.FIELDS.Single(field => field.Id == BflFieldCatalog.DIFFICULTY).Options.Single(option => option.Id == BflFieldCatalog.DIFFICULTY_DEMANDING).Label;
string[] suggestions = [label, label.ToUpperInvariant(), $"„{label}“", $"\"{label}\"", $"**{label}**", $"{label}.", BflFieldCatalog.DIFFICULTY_DEMANDING];
using (Assert.EnterMultipleScope())
{
foreach (var suggestion in suggestions)
{
var answer = BflMarkdownSections.Read($"## [FIELD:difficulty]\n{suggestion}", BflStep.TEST_SITUATION, new BflStepFormData());
Assert.That(answer.FieldSuggestions, Is.EqualTo(new Dictionary<string, string> { [BflFieldCatalog.DIFFICULTY] = BflFieldCatalog.DIFFICULTY_DEMANDING }), suggestion);
}
}
}
[TestCase("## [FIELD:difficulty]\nSomewhat demanding", TestName = "ASuggestionWhichNamesNoOptionIsLeftOut")]
[TestCase("## [FIELD:difficulty]\ndifficulty_moderate, difficulty_demanding", TestName = "ASuggestionWithSeveralOptionsIsLeftOut")]
[TestCase("## [FIELD:goal_directions]\ngoal_inform", TestName = "AFieldWithSeveralChoicesGetsNoSuggestion")]
public void ASuggestionForAChoiceWhichDoesNotFitIsLeftOut(string suggestion)
{
var step = suggestion.Contains("goal_", StringComparison.Ordinal) ? BflStep.GOALS_AND_ROLE : BflStep.TEST_SITUATION;
var answer = BflMarkdownSections.Read(suggestion, step, new BflStepFormData());
Assert.That(answer.FieldSuggestions, Is.Empty);
}
[Test]
public void AChoiceWhichHoldsAnOptionGetsNoSuggestion()
{
var form = new BflStepFormData();
form.Set(BflFieldCatalog.DIFFICULTY, BflFieldCatalog.DIFFICULTY_MODERATE);
var answer = BflMarkdownSections.Read($"## [FIELD:difficulty]\n{BflFieldCatalog.DIFFICULTY_DEMANDING}", BflStep.TEST_SITUATION, form);
Assert.That(answer.FieldSuggestions, Is.Empty);
}
private static BflWorkStateAnswer Read(string answer) => BflMarkdownSections.Read(answer, BflStep.GOALS_AND_ROLE, new BflStepFormData());
private static string FrameworkWithSuggestions(string suggestions) => $"## [FORMAT]\n## [AUDIENCE]\n## [SPEAKING_TIME]\n## [PARTICIPANTS]\n## [CONFLICTS]\n## [OPEN_POINTS]\n{suggestions}";