public void FieldGroup_AddFieldGroup_HasOneFieldGroup()
        {
            var fieldGroup = new FieldGroup("id");

            fieldGroup.AddFieldGroup(new FieldGroup("fieldGroup"));
            Assert.AreEqual(1, fieldGroup.FieldGroups.Count);
        }
        public void FieldGroup_AddFieldGroup_HasNoFields()
        {
            var fieldGroup = new FieldGroup("id");

            fieldGroup.AddFieldGroup(new FieldGroup("fieldGroup"));
            Assert.AreEqual(0, fieldGroup.Fields.Count);
        }
Beispiel #3
0
        public void LoadConfigurableFields()
        {
            Fields = new ObservableCollection <IField>();

            var serializer = new XmlSerializer(typeof(Page), "");

            using (var reader = new StreamReader("Page.xml"))
            {
                var page = (Page)serializer.Deserialize(reader);
                reader.Close();

                foreach (var field in page.Fields.Field)
                {
                    Fields.Add(FieldBuilder.Build(field.id, field.type, field.Mask));
                }

                foreach (var fieldGroup in page.Fields.FieldGroup)
                {
                    var fg = new Model.FieldGroup(fieldGroup.id);
                    foreach (var field in fieldGroup.Field)
                    {
                        fg.AddField(FieldBuilder.Build(field.id, field.type, field.Mask));
                    }
                    FieldGroup.AddFieldGroup(fg);
                }
            }
        }