This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Catalog SDK] Fix serialization issue (#671)
Mirrors NuGet/Samples#34, discovered by @jstoker
- Loading branch information
1 parent
b327a58
commit 3f8258d
Showing
5 changed files
with
44 additions
and
1 deletion.
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
29 changes: 29 additions & 0 deletions
29
tests/NuGet.Protocol.Catalog.Tests/Models/CatalogLeafItemFacts.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,29 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using Newtonsoft.Json; | ||
using Xunit; | ||
|
||
namespace NuGet.Protocol.Catalog | ||
{ | ||
public class CatalogLeafItemFacts | ||
{ | ||
[Fact] | ||
public void JsonSerializationException() | ||
{ | ||
var leafItem = new CatalogLeafItem | ||
{ | ||
Url = "https://api.nuget.org/v3/registration3-gz-semver2/newtonsoft.json/12.0.1.json", | ||
Type = CatalogLeafType.PackageDetails, | ||
CommitTimestamp = DateTimeOffset.Parse("2019-10-10T00:00:00.00+00:00"), | ||
PackageId = "Newtonsoft.Json", | ||
PackageVersion = "12.0.1" | ||
}; | ||
|
||
var result = JsonConvert.SerializeObject(leafItem); | ||
|
||
Assert.Equal(TestData.CatalogLeafItem, result); | ||
} | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.