Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit bae3652

Browse files
committed
Add ModelWithIntegerTypes
1 parent 702548c commit bae3652

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

tests/ServiceStack.Text.Tests/ServiceStack.Text.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,10 @@
203203
<Compile Include="JsonTests\InvalidJsonTests.cs" />
204204
<Compile Include="JsonTests\OnDeserializationErrorTests.cs" />
205205
<Compile Include="JsonTests\TypeInfoTests.cs" />
206+
<Compile Include="JsvTests\JsvBasicDataTests.cs" />
206207
<Compile Include="PclApiTests.cs" />
208+
<Compile Include="Shared\ModelWithFloatTypes.cs" />
209+
<Compile Include="Shared\ModelWithIntegerTypes.cs" />
207210
<Compile Include="Support\NumberTypes.cs" />
208211
<Compile Include="Support\Point.cs" />
209212
<Compile Include="SerializationDelegatePerformanceTests.cs" />
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
namespace ServiceStack.Text.Tests.Shared
2+
{
3+
public class ModelWithIntegerTypes
4+
{
5+
public byte Byte { get; set; }
6+
public short Short { get; set; }
7+
public int Int { get; set; }
8+
public long Long { get; set; }
9+
10+
protected bool Equals(ModelWithIntegerTypes other)
11+
{
12+
return Byte == other.Byte && Short == other.Short && Int == other.Int && Long == other.Long;
13+
}
14+
15+
public override bool Equals(object obj)
16+
{
17+
if (ReferenceEquals(null, obj)) return false;
18+
if (ReferenceEquals(this, obj)) return true;
19+
if (obj.GetType() != this.GetType()) return false;
20+
return Equals((ModelWithIntegerTypes) obj);
21+
}
22+
23+
public override int GetHashCode()
24+
{
25+
unchecked
26+
{
27+
var hashCode = Byte.GetHashCode();
28+
hashCode = (hashCode * 397) ^ Short.GetHashCode();
29+
hashCode = (hashCode * 397) ^ Int;
30+
hashCode = (hashCode * 397) ^ Long.GetHashCode();
31+
return hashCode;
32+
}
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)