-
Notifications
You must be signed in to change notification settings - Fork 0
/
Benchmark.cs
37 lines (29 loc) · 936 Bytes
/
Benchmark.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
using System;
using BenchmarkDotNet.Attributes;
using BenchmarkTest.Mock;
namespace BenchmarkTest
{
public class Benchmark
{
private readonly IInfoParser serializer = new SerializerInfoParser();
private readonly IInfoParser stringBuilder = new StringInfoParser();
[Benchmark]
public void Serialize()
{
serializer.SaveInfo("testKey","testValue");
var result = serializer.GetInfo();
if(result.key == "testKey" && result.value == "testValue")
return;
throw new ApplicationException();
}
[Benchmark]
public void BuildString()
{
stringBuilder.SaveInfo("testKey","testValue");
var result = stringBuilder.GetInfo();
if(result.key == "testKey" && result.value == "testValue")
return;
throw new ApplicationException();
}
}
}