forked from angularsen/UnitsNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestObjectWithValueAsIComparable.cs
More file actions
32 lines (27 loc) · 1010 Bytes
/
TestObjectWithValueAsIComparable.cs
File metadata and controls
32 lines (27 loc) · 1010 Bytes
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
// Licensed under MIT No Attribution, see LICENSE file at the root.
// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
using System;
namespace UnitsNet.Serialization.SystemTextJson.Tests.Infrastructure
{
public sealed class TestObjectWithValueAsIComparable : IComparable
{
public int Value { get; set; }
public int CompareTo(object obj)
{
return ((IComparable)Value).CompareTo(obj);
}
// Needed for verifying that the deserialized object is the same, should not affect the serialization code
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}
return Value.Equals(((TestObjectWithValueAsIComparable)obj).Value);
}
public override int GetHashCode()
{
return Value.GetHashCode();
}
}
}