Skip to content

Commit 8a6f6fd

Browse files
Rename Icon.Src property to Icon.Source for more .NET-y naming
Co-authored-by: MackinnonBuck <[email protected]>
1 parent 9e4eba3 commit 8a6f6fd

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

src/ModelContextProtocol.Core/Protocol/Icon.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public sealed class Icon
4646
/// </para>
4747
/// </remarks>
4848
[JsonPropertyName("src")]
49-
public required string Src { get; init; }
49+
public required string Source { get; init; }
5050

5151
/// <summary>
5252
/// Gets or sets the optional MIME type of the icon.

tests/ModelContextProtocol.Tests/Protocol/IconTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static void Icon_SerializationRoundTrip_PreservesAllProperties()
1111
// Arrange
1212
var original = new Icon
1313
{
14-
Src = "https://example.com/icon.png",
14+
Source = "https://example.com/icon.png",
1515
MimeType = "image/png",
1616
Sizes = "48x48"
1717
};
@@ -24,7 +24,7 @@ public static void Icon_SerializationRoundTrip_PreservesAllProperties()
2424

2525
// Assert
2626
Assert.NotNull(deserialized);
27-
Assert.Equal(original.Src, deserialized.Src);
27+
Assert.Equal(original.Source, deserialized.Source);
2828
Assert.Equal(original.MimeType, deserialized.MimeType);
2929
Assert.Equal(original.Sizes, deserialized.Sizes);
3030
}
@@ -35,7 +35,7 @@ public static void Icon_SerializationRoundTrip_WithOnlyRequiredProperties()
3535
// Arrange
3636
var original = new Icon
3737
{
38-
Src = "data:image/svg+xml;base64,PHN2Zy4uLjwvc3ZnPg=="
38+
Source = "data:image/svg+xml;base64,PHN2Zy4uLjwvc3ZnPg=="
3939
};
4040

4141
// Act - Serialize to JSON
@@ -46,7 +46,7 @@ public static void Icon_SerializationRoundTrip_WithOnlyRequiredProperties()
4646

4747
// Assert
4848
Assert.NotNull(deserialized);
49-
Assert.Equal(original.Src, deserialized.Src);
49+
Assert.Equal(original.Source, deserialized.Source);
5050
Assert.Equal(original.MimeType, deserialized.MimeType);
5151
Assert.Equal(original.Sizes, deserialized.Sizes);
5252
}
@@ -56,7 +56,7 @@ public static void Icon_HasCorrectJsonPropertyNames()
5656
{
5757
var icon = new Icon
5858
{
59-
Src = "https://example.com/icon.svg",
59+
Source = "https://example.com/icon.svg",
6060
MimeType = "image/svg+xml",
6161
Sizes = "any"
6262
};

tests/ModelContextProtocol.Tests/Protocol/ImplementationTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public static void Implementation_SerializationRoundTrip_PreservesAllProperties(
1616
Version = "1.0.0",
1717
Icons =
1818
[
19-
new() { Src = "https://example.com/icon.png", MimeType = "image/png", Sizes = "48x48" },
20-
new() { Src = "https://example.com/icon.svg", MimeType = "image/svg+xml", Sizes = "any" }
19+
new() { Source = "https://example.com/icon.png", MimeType = "image/png", Sizes = "48x48" },
20+
new() { Source = "https://example.com/icon.svg", MimeType = "image/svg+xml", Sizes = "any" }
2121
],
2222
WebsiteUrl = "https://example.com"
2323
};
@@ -39,7 +39,7 @@ public static void Implementation_SerializationRoundTrip_PreservesAllProperties(
3939

4040
for (int i = 0; i < original.Icons.Count; i++)
4141
{
42-
Assert.Equal(original.Icons[i].Src, deserialized.Icons[i].Src);
42+
Assert.Equal(original.Icons[i].Source, deserialized.Icons[i].Source);
4343
Assert.Equal(original.Icons[i].MimeType, deserialized.Icons[i].MimeType);
4444
Assert.Equal(original.Icons[i].Sizes, deserialized.Icons[i].Sizes);
4545
}
@@ -78,7 +78,7 @@ public static void Implementation_HasCorrectJsonPropertyNames()
7878
Name = "test-server",
7979
Title = "Test Server",
8080
Version = "1.0.0",
81-
Icons = [new() { Src = "https://example.com/icon.png" }],
81+
Icons = [new() { Source = "https://example.com/icon.png" }],
8282
WebsiteUrl = "https://example.com"
8383
};
8484

tests/ModelContextProtocol.Tests/Protocol/PromptTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static void Prompt_SerializationRoundTrip_PreservesAllProperties()
1616
Description = "Review the provided code",
1717
Icons =
1818
[
19-
new() { Src = "https://example.com/review-icon.svg", MimeType = "image/svg+xml", Sizes = "any" }
19+
new() { Source = "https://example.com/review-icon.svg", MimeType = "image/svg+xml", Sizes = "any" }
2020
],
2121
Arguments =
2222
[
@@ -37,7 +37,7 @@ public static void Prompt_SerializationRoundTrip_PreservesAllProperties()
3737
Assert.Equal(original.Description, deserialized.Description);
3838
Assert.NotNull(deserialized.Icons);
3939
Assert.Equal(original.Icons.Count, deserialized.Icons.Count);
40-
Assert.Equal(original.Icons[0].Src, deserialized.Icons[0].Src);
40+
Assert.Equal(original.Icons[0].Source, deserialized.Icons[0].Source);
4141
Assert.Equal(original.Icons[0].MimeType, deserialized.Icons[0].MimeType);
4242
Assert.Equal(original.Icons[0].Sizes, deserialized.Icons[0].Sizes);
4343
Assert.NotNull(deserialized.Arguments);
@@ -79,7 +79,7 @@ public static void Prompt_HasCorrectJsonPropertyNames()
7979
Name = "test_prompt",
8080
Title = "Test Prompt",
8181
Description = "A test prompt",
82-
Icons = [new() { Src = "https://example.com/icon.webp" }],
82+
Icons = [new() { Source = "https://example.com/icon.webp" }],
8383
Arguments =
8484
[
8585
new() { Name = "input", Description = "Input parameter" }

tests/ModelContextProtocol.Tests/Protocol/ResourceTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static void Resource_SerializationRoundTrip_PreservesAllProperties()
1919
Size = 1024,
2020
Icons =
2121
[
22-
new() { Src = "https://example.com/pdf-icon.png", MimeType = "image/png", Sizes = "32x32" }
22+
new() { Source = "https://example.com/pdf-icon.png", MimeType = "image/png", Sizes = "32x32" }
2323
],
2424
Annotations = new Annotations { Audience = [Role.User] }
2525
};
@@ -40,7 +40,7 @@ public static void Resource_SerializationRoundTrip_PreservesAllProperties()
4040
Assert.Equal(original.Size, deserialized.Size);
4141
Assert.NotNull(deserialized.Icons);
4242
Assert.Equal(original.Icons.Count, deserialized.Icons.Count);
43-
Assert.Equal(original.Icons[0].Src, deserialized.Icons[0].Src);
43+
Assert.Equal(original.Icons[0].Source, deserialized.Icons[0].Source);
4444
Assert.Equal(original.Icons[0].MimeType, deserialized.Icons[0].MimeType);
4545
Assert.Equal(original.Icons[0].Sizes, deserialized.Icons[0].Sizes);
4646
Assert.NotNull(deserialized.Annotations);
@@ -86,7 +86,7 @@ public static void Resource_HasCorrectJsonPropertyNames()
8686
Description = "A test resource",
8787
MimeType = "text/plain",
8888
Size = 512,
89-
Icons = new List<Icon> { new() { Src = "https://example.com/icon.svg" } },
89+
Icons = new List<Icon> { new() { Source = "https://example.com/icon.svg" } },
9090
Annotations = new Annotations { Audience = [Role.User] }
9191
};
9292

tests/ModelContextProtocol.Tests/Protocol/ToolTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static void Tool_SerializationRoundTrip_PreservesAllProperties()
1616
Description = "Get current weather information",
1717
Icons =
1818
[
19-
new() { Src = "https://example.com/weather.png", MimeType = "image/png", Sizes = "48x48" }
19+
new() { Source = "https://example.com/weather.png", MimeType = "image/png", Sizes = "48x48" }
2020
],
2121
Annotations = new ToolAnnotations
2222
{
@@ -38,7 +38,7 @@ public static void Tool_SerializationRoundTrip_PreservesAllProperties()
3838
Assert.Equal(original.Description, deserialized.Description);
3939
Assert.NotNull(deserialized.Icons);
4040
Assert.Equal(original.Icons.Count, deserialized.Icons.Count);
41-
Assert.Equal(original.Icons[0].Src, deserialized.Icons[0].Src);
41+
Assert.Equal(original.Icons[0].Source, deserialized.Icons[0].Source);
4242
Assert.Equal(original.Icons[0].MimeType, deserialized.Icons[0].MimeType);
4343
Assert.Equal(original.Icons[0].Sizes, deserialized.Icons[0].Sizes);
4444
Assert.NotNull(deserialized.Annotations);
@@ -78,7 +78,7 @@ public static void Tool_HasCorrectJsonPropertyNames()
7878
Name = "test_tool",
7979
Title = "Test Tool",
8080
Description = "A test tool",
81-
Icons = [new() { Src = "https://example.com/icon.png" }],
81+
Icons = [new() { Source = "https://example.com/icon.png" }],
8282
Annotations = new ToolAnnotations { Title = "Annotation Title" }
8383
};
8484

0 commit comments

Comments
 (0)