public void Should_add_error_if_min_greater_than_max() { var sut = new AssetsFieldProperties { MinItems = 10, MaxItems = 5 }; sut.Validate(errors); errors.ShouldBeEquivalentTo( new List <ValidationError> { new ValidationError("Max items must be greater than min items", "MinItems", "MaxItems") }); }
public void Should_set_or_freeze_sut() { var sut = new AssetsFieldProperties(); foreach (var property in sut.GetType().GetRuntimeProperties().Where(x => x.Name != "IsFrozen")) { var value = property.PropertyType.GetTypeInfo().IsValueType ? Activator.CreateInstance(property.PropertyType) : null; property.SetValue(sut, value); var result = property.GetValue(sut); Assert.Equal(value, result); } sut.Freeze(); foreach (var property in sut.GetType().GetRuntimeProperties().Where(x => x.Name != "IsFrozen")) { var value = property.PropertyType.GetTypeInfo().IsValueType ? Activator.CreateInstance(property.PropertyType) : null; Assert.Throws <InvalidOperationException>(() => { try { property.SetValue(sut, value); } catch (Exception ex) { throw ex.InnerException; } }); } }
public static NestedField <AssetsFieldProperties> Assets(long id, string name, AssetsFieldProperties properties = null) { return(new NestedField <AssetsFieldProperties>(id, name, properties ?? new AssetsFieldProperties())); }
public static RootField <AssetsFieldProperties> Assets(long id, string name, Partitioning partitioning, AssetsFieldProperties properties = null) { return(new RootField <AssetsFieldProperties>(id, name, partitioning, properties ?? new AssetsFieldProperties())); }
public static ArrayField AddAssets(this ArrayField field, long id, string name, AssetsFieldProperties properties = null) { return(field.AddField(Assets(id, name, properties))); }
public static Schema AddAssets(this Schema schema, long id, string name, Partitioning partitioning, AssetsFieldProperties properties = null) { return(schema.AddField(Assets(id, name, partitioning, properties))); }
public static NestedField <AssetsFieldProperties> Assets(long id, string name, AssetsFieldProperties properties = null, IFieldSettings settings = null) { return(new NestedField <AssetsFieldProperties>(id, name, properties, settings)); }
public static RootField <AssetsFieldProperties> Assets(long id, string name, Partitioning partitioning, AssetsFieldProperties properties = null, IFieldSettings settings = null) { return(new RootField <AssetsFieldProperties>(id, name, partitioning, properties, settings)); }