This repository was archived by the owner on Sep 21, 2023. It is now read-only.
forked from angularsen/UnitsNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChuckerTest.cs
More file actions
53 lines (39 loc) · 1.56 KB
/
ChuckerTest.cs
File metadata and controls
53 lines (39 loc) · 1.56 KB
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
52
53
// 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 UnitsNet.Serialization.SystemTextJson.Tests.Infrastructure;
using Xunit;
namespace UnitsNet.Serialization.SystemTextJson.Tests
{
public class ChuckerTest : UnitsNetJsonBaseTest
{
[Fact]
public void CellularDataUsage_CanDeserialize()
{
var expected = new CellularDataUsage(
Remaining: Information.FromGibibits(16),
Incremental: null,
Total: Information.FromKibibits(32));
var json = SerializeObject(expected);
var actual = DeserializeObject<CellularDataUsage>(json);
Assert.Equal(expected.Remaining, actual.Remaining);
Assert.Equal(expected.Incremental, actual.Incremental);
Assert.Equal(expected.Total, actual.Total);
}
[Fact]
public void UnitsNet905_CanDeserialize()
{
var expected = new UnitsNet905
{
DataUsage = UnitsNet.Information.FromGibibytes(15)
};
var json = SerializeObject(expected);
var actual = DeserializeObject<UnitsNet905>(json);
Assert.Equal(expected.DataUsage, actual.DataUsage);
}
}
public class UnitsNet905
{
public Information DataUsage { get; set; }
}
public record CellularDataUsage(Information Remaining, Information? Incremental, Information Total);
}