public void BuildFromNewJSONProperly(string json) { List <Tuple <string, DiskUsageData> > list = DiskUsageData.FromJSON(json); Assert.Equal(5, list.Count); for (int i = 0; i < 5; ++i) { Tuple <string, DiskUsageData> tuple = list[i]; Assert.NotNull(tuple); Assert.False(string.IsNullOrEmpty(tuple.Item1)); Assert.NotNull(tuple.Item2); switch (tuple.Item1) { case "C:": Assert.Equal((ulong)449956540416, tuple.Item2.capacity); Assert.Equal((ulong)362764394496, tuple.Item2.free); Assert.Equal((ulong)87192145920, tuple.Item2.used); Assert.Equal((ulong)(449956540416 - 362764394496), tuple.Item2.used); break; case "D:": Assert.Equal((ulong)3150316564480, tuple.Item2.capacity); Assert.Equal((ulong)3070029946880, tuple.Item2.free); Assert.Equal((ulong)80286617600, tuple.Item2.used); break; case "E:": Assert.Equal((ulong)450062446592, tuple.Item2.capacity); Assert.Equal((ulong)321103839232, tuple.Item2.free); Assert.Equal((ulong)128958607360, tuple.Item2.used); break; case "F:": Assert.Equal((ulong)450062446592, tuple.Item2.capacity); Assert.Equal((ulong)419051577344, tuple.Item2.free); Assert.Equal((ulong)31010869248, tuple.Item2.used); break; case "G:": Assert.Equal((ulong)899993825280, tuple.Item2.capacity); Assert.Equal((ulong)895661461504, tuple.Item2.free); Assert.Equal((ulong)4332363776, tuple.Item2.used); break; default: Assert.Equal("", tuple.Item1); Assert.True(false); break; } } }
public void BuildFromOldJSONProperly() { string old_json = "{\"Value\": { \"Disk Capacity\":\"999\",\"Disk Free\":\"444\",\"Disk Name\":\"C:\",\"Disk Used\":\"555\"}}"; List <Tuple <string, DiskUsageData> > list = DiskUsageData.FromJSON(old_json); Assert.Single(list); Tuple <string, DiskUsageData> tuple = list[0]; Assert.NotNull(tuple); Assert.False(string.IsNullOrEmpty(tuple.Item1)); Assert.NotNull(tuple.Item2); Assert.Equal("C:", tuple.Item1); Assert.Equal((ulong)999, tuple.Item2.capacity); Assert.Equal((ulong)444, tuple.Item2.free); Assert.Equal((ulong)555, tuple.Item2.used); }