-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from ARKlab/renovate/messagepack-3.x
chore(deps): update dependency messagepack to v3
- Loading branch information
Showing
8 changed files
with
66 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
MessagePack.NodaTime.Tests/SourceGeneratedContractTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (c) ARK LTD. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for | ||
// license information. | ||
using MessagePack; | ||
using MessagePack.Resolvers; | ||
using NodaTime; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Xunit; | ||
|
||
namespace MessagePack.NodaTime.Tests | ||
{ | ||
[MessagePackObject] | ||
public record MyClass | ||
{ | ||
[Key(0)] | ||
public LocalDateTime LocalDateTime { get; set; } = LocalDateTime.FromDateTime(DateTime.Now); | ||
|
||
[Key(1)] | ||
public Instant Instant { get; set; } = Instant.FromDateTimeUtc(DateTime.UtcNow); | ||
|
||
[Key(2)] | ||
public Period Period { get; set; } = Period.Zero; | ||
|
||
[Key(3)] | ||
public LocalDate LocalDate { get; set; } = LocalDate.FromDateTime(DateTime.Now.Date); | ||
|
||
[Key(4)] | ||
public OffsetDateTime OffsetDateTime { get; set; } = OffsetDateTime.FromDateTimeOffset(DateTimeOffset.Now); | ||
|
||
[Key(5)] | ||
public Duration Duration { get; set; } = Duration.Zero; | ||
|
||
[Key(6)] | ||
public ZonedDateTime ZonedDateTime { get; set; } = ZonedDateTime.FromDateTimeOffset(DateTimeOffset.Now); | ||
} | ||
|
||
[Collection("ResolverCollection")] | ||
public class SourceGeneratedContractTests | ||
{ | ||
[Fact] | ||
public void Roundtrip() | ||
{ | ||
var o = new MyClass { LocalDateTime = LocalDateTime.FromDateTime(DateTime.Now) }; | ||
var bin = MessagePackSerializer.Serialize(o); | ||
var res = MessagePackSerializer.Deserialize<MyClass>(bin); | ||
|
||
Assert.Equal(o.LocalDateTime, res.LocalDateTime); // in DateTime format due to 'abc' being DateTime object | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters