You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NuGetGallery/tests/CatalogTests/TestCatalogItem.cs

44 lines
1.0 KiB
C#

using Newtonsoft.Json.Linq;
using NuGet.Services.Metadata.Catalog.Maintenance;
using System;
namespace CatalogTests
{
class TestCatalogItem : CatalogItem
{
string _name;
Uri _type;
public TestCatalogItem(string name)
{
_name = name;
_type = new Uri("http://test.org/schema#TestItem");
}
public override string CreateContent(CatalogContext context)
{
string id = GetBaseAddress() + _name + ".json";
JObject obj = new JObject
{
{ "name", _name },
{ "@id", id },
{ "@type", _type },
{ "@context", new JObject { { "@vocab", "http://test.org/schema#" } } }
};
return obj.ToString();
}
public override Uri GetItemType()
{
return _type;
}
protected override string GetItemIdentity()
{
return _name;
}
}
}