Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/StronglyTypedIds.Templates/long-full.typedid
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
public partial class PLACEHOLDERIDSystemTextJsonConverter : global::System.Text.Json.Serialization.JsonConverter<PLACEHOLDERID>
{
public override PLACEHOLDERID Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
=> new (reader.GetInt32());
=> new (reader.GetInt64());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this change should cause a change in this snapshot? 🤔

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Author

@mithileshz mithileshz Apr 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @andrewlock

I am unable to find the test that affects that snapshot. I had a look at the history of the snapshot here and wasn't able to find a test that is used for this specific snapshot. Can I get some help/a hint in where to look please?


public override void Write(global::System.Text.Json.Utf8JsonWriter writer, PLACEHOLDERID value, global::System.Text.Json.JsonSerializerOptions options)
=> writer.WriteNumberValue(value.Value);
Expand Down
12 changes: 12 additions & 0 deletions test/StronglyTypedIds.IntegrationTests/LongIdTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,18 @@ public void CanDeserializeFromLong_WithSystemTextJsonProvider()
Assert.Equal(foo, deserializedFoo);
}

[Fact]
public void CanDeserializeFromLong_MaxLongValue_WithSystemTextJsonProvider()
{
var value = long.MaxValue;
var foo = new ConvertersLongId(value);
var serializedLong = SystemTextJsonSerializer.Serialize(value);

var deserializedFoo = SystemTextJsonSerializer.Deserialize<ConvertersLongId>(serializedLong);

Assert.Equal(foo, deserializedFoo);
}

[Fact]
public void WhenEfCoreValueConverterUsesValueConverter()
{
Expand Down