mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-11 07:07:22 +00:00
Upgraded to .NET 10 (#1147)
This commit is contained in:
1 parent
faae2951f7
commit
fc7399e81b
327 files changed
+3059
-3049
No files matched your search
@@ -15,13 +15,13 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
|
||||
var parsed = SwotCategoryAnalysisResponseParser.TryParse(JsonSerializer.Serialize(result), out var parsedResult, out var issue);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(parsed, Is.True);
|
||||
Assert.That(issue, Is.Empty);
|
||||
Assert.That(parsedResult.EmptyMessage, Is.Empty);
|
||||
Assert.That(parsedResult.Findings.Single().Summary, Is.EqualTo("Experienced team"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -29,11 +29,11 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
{
|
||||
var parsed = SwotCategoryAnalysisResponseParser.TryParse("I cannot analyze this category.", out _, out var issue);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(parsed, Is.False);
|
||||
Assert.That(issue, Does.Contain("no complete JSON object"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -41,11 +41,11 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
{
|
||||
var parsed = SwotCategoryAnalysisResponseParser.TryParse("""{"findings": [{"summary": "Experienced team",}""", out _, out var issue);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(parsed, Is.False);
|
||||
Assert.That(issue, Is.Not.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -53,11 +53,11 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
{
|
||||
var parsed = SwotCategoryAnalysisResponseParser.TryParse("""{"empty_message": null, "findings": []}""", out _, out var issue);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(parsed, Is.False);
|
||||
Assert.That(issue, Does.StartWith("The JSON object cannot be read:"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -65,11 +65,11 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
{
|
||||
var parsed = SwotCategoryAnalysisResponseParser.TryParse("""{"empty_message": "", "findings": [null, {"summary": "Experienced team", "explanation": "Long tenure."}]}""", out var result, out _);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(parsed, Is.True);
|
||||
Assert.That(result.Findings.Single().Summary, Is.EqualTo("Experienced team"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -81,13 +81,13 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
});
|
||||
var invalidEmptyResponse = JsonSerializer.Serialize(new SwotCategoryAnalysisResult());
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(SwotCategoryAnalysisResponseParser.TryParse(validEmptyResponse, out var result, out _), Is.True);
|
||||
Assert.That(result.Findings, Is.Empty);
|
||||
Assert.That(SwotCategoryAnalysisResponseParser.TryParse(invalidEmptyResponse, out _, out var issue), Is.False);
|
||||
Assert.That(issue, Does.Contain("empty_message"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -101,13 +101,13 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
result.Findings[0].Explanation = string.Empty;
|
||||
var responseWithoutExplanation = JsonSerializer.Serialize(result);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(SwotCategoryAnalysisResponseParser.TryParse(responseWithContradictoryEmptyMessage, out _, out var contradictionIssue), Is.False);
|
||||
Assert.That(contradictionIssue, Does.Contain("Leave empty_message empty"));
|
||||
Assert.That(SwotCategoryAnalysisResponseParser.TryParse(responseWithoutExplanation, out _, out var explanationIssue), Is.False);
|
||||
Assert.That(explanationIssue, Is.EqualTo("Finding 1 has no explanation."));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("STRENGTHS", "strengths: internal positive factors")]
|
||||
@@ -119,7 +119,7 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
var category = Enum.Parse<SwotAnalysisCategory>(categoryName);
|
||||
var prompt = SwotCategoryAnalysis.BuildSystemPrompt(category, "Answer in German.");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(prompt, Does.Contain($"Analyze only {expectedDescription}."));
|
||||
Assert.That(prompt, Does.Contain("Do not return findings for another SWOT category."));
|
||||
@@ -127,7 +127,7 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
Assert.That(prompt, Does.Contain("analysis-subject, contextual-knowledge, and\nshared-research"));
|
||||
Assert.That(prompt, Does.Contain("untrusted data"));
|
||||
Assert.That(prompt, Does.EndWith("Answer in German."));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -140,14 +140,14 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
new SwotContextualKnowledge("The annual report names 120 employees.", []),
|
||||
sharedResearch: "A market report documents increasing regional demand.");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(request, Does.Match("(?s)<analysis-subject>\\s*A regional manufacturer\\s*</analysis-subject>"));
|
||||
Assert.That(request, Does.Match("(?s)<analysis-goal>\\s*Support the investment decision\\s*</analysis-goal>"));
|
||||
Assert.That(request, Does.Match("(?s)<analysis-focus>\\s*Pay particular attention to staffing\\s*</analysis-focus>"));
|
||||
Assert.That(request, Does.Match("(?s)<contextual-knowledge>\\s*The annual report names 120 employees\\.\\s*</contextual-knowledge>"));
|
||||
Assert.That(request, Does.Match("(?s)<shared-research>\\s*A market report documents increasing regional demand\\.\\s*</shared-research>"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -159,12 +159,12 @@ public sealed class SwotCategoryAnalysisResponseTests
|
||||
string.Empty,
|
||||
SwotContextualKnowledge.NONE);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(request, Does.Not.Contain("<shared-research>"));
|
||||
Assert.That(request, Does.Contain("No additional analysis focus was provided."));
|
||||
Assert.That(request, Does.Contain("No additional contextual knowledge was provided."));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static SwotCategoryAnalysisResult CreateResult() => new()
|
||||
|
||||
Reference in new issue
Block a user