public void ToAdsml_Throws_InvalidOperationException_If_Name_Is_Not_Set()
        {
            //Arrange
            var ca = new CompositeAttribute
            {
                CompositeValues = new List <CompositeValue>
                {
                    new CompositeValue
                    {
                        Fields = new List <Field>
                        {
                            new Field
                            {
                                Name  = "bar",
                                Type  = "text",
                                Value = "baz"
                            }
                        }
                    }
                }
            };

            //Act
            ca.ToAdsml();
        }
        public void Can_Instantiate_New_CompositeAttribute()
        {
            //Act
            var ca = new CompositeAttribute();

            //Assert
            Assert.That(ca, Is.Not.Null);
        }
        public void Can_Generate_Api_Xml()
        {
            //Arrange
            string expected =
                new XElement("CompositeAttribute",
                             new XAttribute("name", "foo"),
                             new XElement("CompositeValue",
                                          new XElement("Field",
                                                       new XAttribute("name", "bar"),
                                                       new XAttribute("type", "text"),
                                                       new XCData("baz")))).ToString();


            var ca = new CompositeAttribute
            {
                Name            = "foo",
                CompositeValues = new List <CompositeValue>
                {
                    new CompositeValue
                    {
                        Fields = new List <Field>
                        {
                            new Field
                            {
                                Name  = "bar",
                                Type  = "text",
                                Value = "baz"
                            }
                        }
                    }
                }
            };

            //Act
            string actual = ca.ToAdsml().ToString();

            Console.WriteLine(actual);

            //Assert
            Assert.That(actual, Is.EqualTo(expected));
        }
 public ComplexDataElement(PropertyInfo propertyInfo, CompositeAttribute cAttr, object instance = null)
     : base(propertyInfo.GetGenericType(), propertyInfo.Name, cAttr.Id)
 {
     BuildChildren(instance, true);
 }