-
-
Notifications
You must be signed in to change notification settings - Fork 158
/
Copy pathJsonApiSerializer_Benchmarks.cs
51 lines (41 loc) · 2.1 KB
/
JsonApiSerializer_Benchmarks.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//using System.Collections.Generic;
//using BenchmarkDotNet.Attributes;
//using BenchmarkDotNet.Attributes.Exporters;
//using JsonApiDotNetCore.Builders;
//using JsonApiDotNetCore.Configuration;
//using JsonApiDotNetCore.Internal.Generics;
//using JsonApiDotNetCore.Models;
//using JsonApiDotNetCore.Serialization;
using JsonApiDotNetCore.Serialization.Contracts;
//using JsonApiDotNetCore.Services;
//using Moq;
//using Newtonsoft.Json.Serialization;
//namespace Benchmarks.Serialization {
// [MarkdownExporter]
// public class JsonApiSerializer_Benchmarks {
// private const string TYPE_NAME = "simple-types";
// private static readonly SimpleType Content = new SimpleType();
// private readonly JsonApiSerializer _jsonApiSerializer;
// public JsonApiSerializer_Benchmarks() {
// var resourceGraphBuilder = new ResourceGraphBuilder();
// resourceGraphBuilder.AddResource<SimpleType>(TYPE_NAME);
// var resourceGraph = resourceGraphBuilder.Build();
// var jsonApiContextMock = new Mock<IJsonApiContext>();
// jsonApiContextMock.SetupAllProperties();
// jsonApiContextMock.Setup(m => m.ResourceGraph).Returns(resourceGraph);
// jsonApiContextMock.Setup(m => m.AttributesToUpdate).Returns(new Dictionary<AttrAttribute, object>());
// var jsonApiOptions = new JsonApiOptions();
// jsonApiOptions.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
// jsonApiContextMock.Setup(m => m.Options).Returns(jsonApiOptions);
// var genericServiceFactoryMock = new Mock<IgenericServiceFactory>();
// var documentBuilder = new BaseDocumentBuilder(jsonApiContextMock.Object);
// _jsonApiSerializer = new JsonApiSerializer(jsonApiContextMock.Object, documentBuilder);
// }
// [Benchmark]
// public object SerializeSimpleObject() => _jsonApiSerializer.Serialize(Content);
// private class SimpleType : Identifiable {
// [Attr("name")]
// public string Name { get; set; }
// }
// }
//}