public void Should_add_error_if_editor_is_not_valid() { var sut = new BooleanFieldProperties { Editor = (BooleanFieldEditor)123 }; sut.Validate(errors); errors.ShouldBeEquivalentTo( new List <ValidationError> { new ValidationError("Editor is not a valid value", "Editor") }); }
public void Should_set_or_freeze_sut() { var sut = new BooleanFieldProperties(); 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 <BooleanFieldProperties> Boolean(long id, string name, BooleanFieldProperties properties = null) { return(new NestedField <BooleanFieldProperties>(id, name, properties ?? new BooleanFieldProperties())); }
public static RootField <BooleanFieldProperties> Boolean(long id, string name, Partitioning partitioning, BooleanFieldProperties properties = null) { return(new RootField <BooleanFieldProperties>(id, name, partitioning, properties ?? new BooleanFieldProperties())); }
public static ArrayField AddBoolean(this ArrayField field, long id, string name, BooleanFieldProperties properties = null) { return(field.AddField(Boolean(id, name, properties))); }
public static Schema AddBoolean(this Schema schema, long id, string name, Partitioning partitioning, BooleanFieldProperties properties = null) { return(schema.AddField(Boolean(id, name, partitioning, properties))); }
public static NestedField <BooleanFieldProperties> Boolean(long id, string name, BooleanFieldProperties properties = null, IFieldSettings settings = null) { return(new NestedField <BooleanFieldProperties>(id, name, properties, settings)); }
public static RootField <BooleanFieldProperties> Boolean(long id, string name, Partitioning partitioning, BooleanFieldProperties properties = null, IFieldSettings settings = null) { return(new RootField <BooleanFieldProperties>(id, name, partitioning, properties, settings)); }