public void Should_have_target_type_name_in_InvalidCastException_message_thrown_by_As_method() { var value = new HerculesValue <int>(150); new Action(() => value.AsLong.GetHashCode()) .Should() .Throw <InvalidCastException>() .Where(x => x.Message.Contains(typeof(long).ToString())); }
private static bool HasChildren([CanBeNull] HerculesValue value) { if (value == null) { return(false); } if (value.IsContainer && value.AsContainer.Count > 0) { return(true); } if (value.IsVector && value.AsVector.Count > 0) { return(true); } return(false); }
private static void Render([CanBeNull] HerculesValue value, [NotNull] StringBuilder builder, int depth) { if (value == null || value.IsNull) { builder.Indent(depth).Append(NullRepresentation); } else if (value.IsContainer) { Render(value.AsContainer, builder, depth); } else if (value.IsVector) { Render(value.AsVector, builder, depth); } else { builder.Indent(depth).Append(value); } }
public void Value_property_should_unwrap_simple_typed_values() { var value = new HerculesValue <int>(150); value.Value.Should().Be(150); }
public void Value_property_should_unwrap_vectors() { var value = new HerculesValue <HerculesVector>(new HerculesVector <int>(new[] { 1, 2, 3 })); value.Value.Should().BeEquivalentTo(new[] { 1, 2, 3 }); }
public void Value_property_should_unwrap_nulls() { var value = new HerculesValue <HerculesNull>(HerculesNull.Instance); value.Value.Should().BeNull(); }
private HerculesTagsBuilder Set(string key, HerculesValue value) { tags = tags.Set(key, value); return(this); }