protected void Latitude_ExpectParseResultToMatchNull() { // arrange ScalarType scalar = new LatitudeType(); object valueSyntax = null !; // act IValueNode result = scalar.ParseResult(valueSyntax); // assert Assert.Equal(typeof(NullValueNode), result.GetType()); }
Latitude_ExpectDeserializeStringToThrowSerializationException_GreaterThanMax() { // arrange ScalarType scalar = new LatitudeType(); const string?valueSyntax = "92° 0' 0.000\" N" !; // act Exception?result = Record.Exception(() => scalar.Deserialize(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
protected void Latitude_ExpectSerializeDoubleToThrowSerializationException_GreaterThanMax() { // arrange ScalarType scalar = new LatitudeType(); const double valueSyntax = 91d; // act Exception?result = Record.Exception(() => scalar.Serialize(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
protected void Latitude_ExpectSerializeIntToThrowSerializationException_LessThanMin() { // arrange ScalarType scalar = new LatitudeType(); const int valueSyntax = -91; // act Exception?result = Record.Exception(() => scalar.Serialize(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
protected void Latitude_ExpectParseResultToThrowOnInvalidType() { // arrange ScalarType scalar = new LatitudeType(); const char valueSyntax = 'c'; // act Exception?result = Record.Exception(() => scalar.ParseResult(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
protected void Latitude_ExpectParseResultToMatchDouble() { // arrange ScalarType scalar = new LatitudeType(); const double valueSyntax = 89d; // act IValueNode result = scalar.ParseResult(valueSyntax); // assert Assert.Equal(typeof(StringValueNode), result.GetType()); }
protected void Latitude_ExpectParseResultToThrowOnInvalidString() { // arrange ScalarType scalar = new LatitudeType(); var valueSyntax = "92° 0' 0.000\" S"; // act Exception?result = Record.Exception(() => scalar.ParseResult(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
public void Latitude_ExpectSerializeDouble() { // arrange ScalarType scalar = new LatitudeType(); const double valueSyntax = 89d; // act var success = scalar.TrySerialize(valueSyntax, out var d); // assert Assert.True(success); Assert.IsType <string>(d); }
protected void Latitude_ExpectDeserializeStringToThrowSerializationException_LessThanMin() { // arrange ScalarType scalar = new LatitudeType(); const string valueSyntax = "91° 0' 0.000\" S" !; // act Exception?result = Record.Exception(() => scalar.Deserialize(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
protected void Latitude_ExpectDeserializeStringToMatch() { // arrange ScalarType scalar = new LatitudeType(); const double expectedValue = -89d; // act var success = scalar.TryDeserialize("89° 0' 0.000\" S", out var deserialized); // assert Assert.True(success); Assert.Equal(expectedValue, deserialized); }