public void Longitude_EnsureLongitudeTypeKindIsCorrect() { // arrange // act ScalarType type = new LongitudeType(); // assert Assert.Equal(TypeKind.Scalar, type.Kind); }
protected void Longitude_ExpectParseResultToMatchNull() { // arrange ScalarType scalar = new LongitudeType(); object valueSyntax = null !; // act IValueNode result = scalar.ParseResult(valueSyntax); // assert Assert.Equal(typeof(NullValueNode), result.GetType()); }
protected void Longitude_ExpectSerializeDoubleToThrowSerializationException_GreaterThanMax() { // arrange ScalarType scalar = new LongitudeType(); const double valueSyntax = 181d; // act Exception?result = Record.Exception(() => scalar.Serialize(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
protected void Longitude_ExpectSerializeIntToThrowSerializationException_LessThanMin() { // arrange ScalarType scalar = new LongitudeType(); const int valueSyntax = -181; // act Exception?result = Record.Exception(() => scalar.Serialize(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
Longitude_ExpectDeserializeStringToThrowSerializationException_GreaterThanMax() { // arrange ScalarType scalar = new LongitudeType(); const string?valueSyntax = "182° 0' 0.000\" E" !; // act Exception?result = Record.Exception(() => scalar.Deserialize(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
protected void Longitude_ExpectParseResultToThrowOnInvalidType() { // arrange ScalarType scalar = new LongitudeType(); const char valueSyntax = 'c'; // act Exception?result = Record.Exception(() => scalar.ParseResult(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
protected void Longitude_ExpectParseResultToMatchDouble() { // arrange ScalarType scalar = new LongitudeType(); const double valueSyntax = 179d; // act IValueNode result = scalar.ParseResult(valueSyntax); // assert Assert.Equal(typeof(StringValueNode), result.GetType()); }
protected void Longitude_ExpectParseResultToThrowOnInvalidString() { // arrange ScalarType scalar = new LongitudeType(); const string valueSyntax = "-181° 0' 0.000\" W" !; // act Exception?result = Record.Exception(() => scalar.ParseResult(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
public void Longitude_ExpectSerializeDouble() { // arrange ScalarType scalar = new LongitudeType(); const double valueSyntax = 179d; // act var success = scalar.TrySerialize(valueSyntax, out var d); // assert Assert.True(success); Assert.IsType <string>(d); }
protected void Longitude_ExpectDeserializeStringToThrowSerializationException_LessThanMin() { // arrange ScalarType scalar = new LongitudeType(); const string valueSyntax = "-181° 0' 0.000\" W" !; // act Exception?result = Record.Exception(() => scalar.Deserialize(valueSyntax)); // assert Assert.IsType <SerializationException>(result); }
protected void Longitude_ExpectDeserializeStringToMatch() { // arrange ScalarType scalar = new LongitudeType(); const double expectedValue = -179d; // act var success = scalar.TryDeserialize("179° 0' 0.000\" W", out var deserialized); // assert Assert.True(success); Assert.Equal(expectedValue, deserialized); }