public void SupportsAutoGenerate() { var result = new FormFieldCreator().Create(typeof(MyForm)); Assert.True(result.Single(f => f.Id == nameof(MyForm.NormalProperty)).AutoGenerate); Assert.False(result.Single(f => f.Id == nameof(MyForm.AutoGenerateFalse)).AutoGenerate); }
public void SupportsBool() { var result = new FormFieldCreator().Create(typeof(GenericForm <bool>)); Assert.Single(result); Assert.Equal("boolean", result.Single().Type); }
public void SupportsDouble() { var result = new FormFieldCreator().Create(typeof(GenericForm <double>)); Assert.Single(result); Assert.Equal("double", result.Single().Type); }
public void SupportsInt() { var result = new FormFieldCreator().Create(typeof(GenericForm <int>)); Assert.Single(result); Assert.Equal("int", result.Single().Type); }
public void SupportsString() { var result = new FormFieldCreator().Create(typeof(GenericForm <string>)); Assert.Single(result); Assert.Equal("string", result.Single().Type); }
public void CreatesFieldsFromCompleteProperties() { var result = new FormFieldCreator().Create(typeof(TestForm)); Assert.Single(result); Assert.Equal(nameof(TestForm.Property), result.Single().Id); }
public IEnumerable <Form> Create() { var result = new List <Form>(); foreach (var type in FormTypeProvider.GetTypes()) { var attribute = type.GetCustomAttribute <FormAttribute>(); result.Add(new Form(attribute.Id, FormFieldCreator.Create(type))); } return(result); }