Skip to content

Commit

Permalink
Changes based on code review by @anjdreas
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Ovegard committed Nov 1, 2016
1 parent c56f4a4 commit 5a165d7
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions UnitsNet.Serialization.JsonNet.Tests/UnitsNetJsonConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ public void UnitInIComparable_ExpectUnitCorrectlyDeserialized()
{
Value = Power.FromWatts(10)
};
JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettigns();
JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettings();

string json = JsonConvert.SerializeObject(testObjWithIComparable,jsonSerializerSettings);
string json = JsonConvert.SerializeObject(testObjWithIComparable, jsonSerializerSettings);

var deserializedTestObject = JsonConvert.DeserializeObject<TestObjWithIComparable>(json,jsonSerializerSettings);

Expand All @@ -252,7 +252,7 @@ public void DoubleInIComparable_ExpectUnitCorrectlyDeserialized()
{
Value = 10.0
};
JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettigns();
JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettings();

string json = JsonConvert.SerializeObject(testObjWithIComparable, jsonSerializerSettings);

Expand All @@ -269,7 +269,7 @@ public void ClassInIComparable_ExpectUnitCorrectlyDeserialized()
{
Value = new ComparableClass() { Value = 10 }
};
JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettigns();
JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettings();

string json = JsonConvert.SerializeObject(testObjWithIComparable, jsonSerializerSettings);
var deserializedTestObject = JsonConvert.DeserializeObject<TestObjWithIComparable>(json, jsonSerializerSettings);
Expand All @@ -286,7 +286,7 @@ public void OtherObjectWithUnitAndValue_ExpectCorrectResturnValues()
Value = 5,
Unit = "Test",
};
JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettigns();
JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettings();

string json = JsonConvert.SerializeObject(testObjWithValueAndUnit, jsonSerializerSettings);
TestObjWithValueAndUnit deserializedTestObject = JsonConvert.DeserializeObject<TestObjWithValueAndUnit>(json, jsonSerializerSettings);
Expand All @@ -308,20 +308,20 @@ public void ThreeObjectsInIComparableWithDifferentValues_ExpectAllCorrectlyDeser
Value2 = comparable2,
Value3 = comparable3,
};
JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettigns();
JsonSerializerSettings jsonSerializerSettings = CreateJsonSerializerSettings();

string json = JsonConvert.SerializeObject(testObjWithIComparable, jsonSerializerSettings);
var deserializedTestObject = JsonConvert.DeserializeObject<TestObjWithThreeIComparable>(json, jsonSerializerSettings);

Assert.That(deserializedTestObject.Value1.GetType(), Is.EqualTo(comparable1.GetType()));
Assert.That(((deserializedTestObject.Value1)), Is.EqualTo(comparable1));
Assert.That((deserializedTestObject.Value1), Is.EqualTo(comparable1));
Assert.That(deserializedTestObject.Value2.GetType(), Is.EqualTo(comparable2.GetType()));
Assert.That(((deserializedTestObject.Value2)), Is.EqualTo(comparable2));
Assert.That((deserializedTestObject.Value2), Is.EqualTo(comparable2));
Assert.That(deserializedTestObject.Value3.GetType(), Is.EqualTo(comparable3.GetType()));
Assert.That(((deserializedTestObject.Value3)), Is.EqualTo(comparable3));
Assert.That((deserializedTestObject.Value3), Is.EqualTo(comparable3));
}

public static object[] TestObjectsForThreeObjectsInIComparableWithDifferentValues_ExpectAllCorrectlyDeserialized
private static object[] TestObjectsForThreeObjectsInIComparableWithDifferentValues_ExpectAllCorrectlyDeserialized
{
get
{
Expand All @@ -341,7 +341,7 @@ public static object[] TestObjectsForThreeObjectsInIComparableWithDifferentValue
}
}

private static JsonSerializerSettings CreateJsonSerializerSettigns()
private static JsonSerializerSettings CreateJsonSerializerSettings()
{
var jsonSerializerSettings = new JsonSerializerSettings()
{
Expand All @@ -353,13 +353,13 @@ private static JsonSerializerSettings CreateJsonSerializerSettigns()
}
}

internal class TestObj
private class TestObj
{
public Frequency? NullableFrequency { get; set; }
public Frequency NonNullableFrequency { get; set; }
}

internal class TestObjWithValueAndUnit : IComparable
private class TestObjWithValueAndUnit : IComparable
{
public double Value { get; set; }
public string Unit { get; set; }
Expand All @@ -370,7 +370,7 @@ public int CompareTo(object obj)
}
}

internal class ComparableClass : IComparable
private class ComparableClass : IComparable
{
public int Value { get; set; }
public int CompareTo(object obj)
Expand All @@ -394,12 +394,12 @@ public override int GetHashCode()
}
}

internal class TestObjWithIComparable
private class TestObjWithIComparable
{
public IComparable Value { get; set; }
}

internal class TestObjWithThreeIComparable
private class TestObjWithThreeIComparable
{
public IComparable Value1 { get; set; }

Expand Down

4 comments on commit 5a165d7

@angularsen
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Units.NET :: Build and Test Build 236 is now running

@angularsen
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Units.NET :: Build and Test Build 236 outcome was SUCCESS
Summary: Tests passed: 846 Build time: 0:0:39

@angularsen
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Units.NET :: Build and Test Build 237 is now running

@angularsen
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Units.NET :: Build and Test Build 237 outcome was SUCCESS
Summary: Tests passed: 846 Build time: 0:0:33

Please sign in to comment.