public void DirectReferenceCanConvertToJConstructorAndBack() { var reference = new DirectReference("aws_instance.my_instance"); var jc = reference.ToJConstructor(); var newReference = Reference.FromJConstructor(jc); newReference.ReferenceExpression.Should().Be(reference.ReferenceExpression); }
public void DirectReferenceCanBeEncodedAndDecoded() { var reference = new DirectReference("aws_instance.my_instance"); var jtoken = JObject.Parse(json); var property = (JProperty)jtoken.SelectToken("Property")?.Parent; property.Value = reference.ToJConstructor(); var token1 = JObject.Parse(jtoken.ToString(Formatting.None)); var con = (JConstructor)token1.SelectToken("Property"); var outReference = Reference.FromJConstructor(con); outReference.ReferenceExpression.Should().Be(reference.ReferenceExpression); }