Skip to content

Commit 1664044

Browse files
jozkeeCopilot
andauthored
Fix 115 xUnit test warnings in MEAI.Abstractions.Tests (#7369)
- Fix duplicate test case IDs caused by unused gapBeginningEnd loop variable - Suppress non-serializable data warnings with DisableDiscoveryEnumeration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 07ae952 commit 1664044

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/ChatCompletion/ChatResponseUpdateExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ public static IEnumerable<object[]> ToChatResponse_Coalescing_VariousSequenceAnd
611611
{
612612
foreach (bool gapBeginningEnd in new[] { false, true })
613613
{
614-
yield return new object[] { useAsync, numSequences, sequenceLength, gapLength, false };
614+
yield return new object[] { useAsync, numSequences, sequenceLength, gapLength, gapBeginningEnd };
615615
}
616616
}
617617
}

test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/ToolApprovalRequestContentTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void Constructor_InvalidArguments_Throws()
2828
};
2929

3030
[Theory]
31-
[MemberData(nameof(ToolCallContentInstances))]
31+
[MemberData(nameof(ToolCallContentInstances), DisableDiscoveryEnumeration = true)]
3232
public void Constructor_Roundtrips(ToolCallContent toolCall)
3333
{
3434
string id = "req-1";
@@ -39,7 +39,7 @@ public void Constructor_Roundtrips(ToolCallContent toolCall)
3939
}
4040

4141
[Theory]
42-
[MemberData(nameof(ToolCallContentInstances))]
42+
[MemberData(nameof(ToolCallContentInstances), DisableDiscoveryEnumeration = true)]
4343
public void CreateResponse_ReturnsExpectedResponse(ToolCallContent toolCall)
4444
{
4545
string id = "req-1";
@@ -76,7 +76,7 @@ public void CreateResponse_WithReason_ReturnsExpectedResponse(bool approved, str
7676
}
7777

7878
[Theory]
79-
[MemberData(nameof(ToolCallContentInstances))]
79+
[MemberData(nameof(ToolCallContentInstances), DisableDiscoveryEnumeration = true)]
8080
public void Serialization_Roundtrips(ToolCallContent toolCall)
8181
{
8282
var content = new ToolApprovalRequestContent("request123", toolCall);

test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Contents/ToolApprovalResponseContentTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void Constructor_InvalidArguments_Throws()
2828
};
2929

3030
[Theory]
31-
[MemberData(nameof(ToolCallContentInstances))]
31+
[MemberData(nameof(ToolCallContentInstances), DisableDiscoveryEnumeration = true)]
3232
public void Constructor_Roundtrips(ToolCallContent toolCall)
3333
{
3434
ToolApprovalResponseContent content = new("req-1", true, toolCall);
@@ -45,7 +45,7 @@ public void Constructor_Roundtrips(ToolCallContent toolCall)
4545
}
4646

4747
[Theory]
48-
[MemberData(nameof(ToolCallContentInstances))]
48+
[MemberData(nameof(ToolCallContentInstances), DisableDiscoveryEnumeration = true)]
4949
public void Serialization_Roundtrips(ToolCallContent toolCall)
5050
{
5151
var content = new ToolApprovalResponseContent("request123", true, toolCall)

test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/SpeechToText/SpeechToTextResponseUpdateExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static IEnumerable<object[]> ToSpeechToTextResponse_Coalescing_VariousSeq
2424
{
2525
foreach (bool gapBeginningEnd in new[] { false, true })
2626
{
27-
yield return new object[] { useAsync, numSequences, sequenceLength, gapLength, false };
27+
yield return new object[] { useAsync, numSequences, sequenceLength, gapLength, gapBeginningEnd };
2828
}
2929
}
3030
}

test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/Utilities/AIJsonUtilitiesTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ public static void CreateJsonSchema_CanBeBoolean()
588588
}
589589

590590
[Theory]
591-
[MemberData(nameof(TestTypes.GetTestDataUsingAllValues), MemberType = typeof(TestTypes))]
591+
[MemberData(nameof(TestTypes.GetTestDataUsingAllValues), MemberType = typeof(TestTypes), DisableDiscoveryEnumeration = true)]
592592
public static void CreateJsonSchema_ValidateWithTestData(ITestData testData)
593593
{
594594
// Stress tests the schema generation method using types from the JsonSchemaExporter test battery.
@@ -1730,7 +1730,7 @@ public static void TransformJsonSchema_MoveDefaultKeywordToDescription()
17301730
}
17311731

17321732
[Theory]
1733-
[MemberData(nameof(TestTypes.GetTestDataUsingAllValues), MemberType = typeof(TestTypes))]
1733+
[MemberData(nameof(TestTypes.GetTestDataUsingAllValues), MemberType = typeof(TestTypes), DisableDiscoveryEnumeration = true)]
17341734
public static void TransformJsonSchema_ValidateWithTestData(ITestData testData)
17351735
{
17361736
// Stress tests the schema generation method using types from the JsonSchemaExporter test battery.

0 commit comments

Comments
 (0)