public void CanSpecifyNodeName()
        {
            //Act
            var acon = new AttributeControl("Foo", new AttributeTypeToReturn {
                Type = AttributeDataType.StructureText
            });

            //Assert
            Assert.That(acon.ToAdsml().Name.ToString(), Is.EqualTo("Foo"));
        }
        public void CanSpecifyIdList()
        {
            //Arrange
            string expected = new XElement("Foo", new XAttribute("idlist", "1, 2, 3, 4")).ToString();

            //Act
            var acon = new AttributeControl("Foo", new [] { 1, 2, 3, 4 });

            //Assert
            Assert.That(acon.ToAdsml().ToString(), Is.EqualTo(expected));
        }
        public void Can_Generate_Api_Xml()
        {
            //Arrange
            var expected = new XElement("AttributesToReturn", new XElement("Attribute", new XAttribute("id", "20")));
            var asc      = new AttributeControl(new AttributeToReturn {
                DefinitionId = 20
            });

            //Act
            var actual = asc.ToAdsml();

            //Assert
            Assert.That(actual.ToString(), Is.EqualTo(expected.ToString()));
        }
        public void CanSpecifyAttributesToReturnWithAttributeNodes()
        {
            //Arrange
            string expected =
                new XElement("AttributesToReturn",
                             new XElement("Attribute", new XAttribute("name", "foo"))).ToString();

            //Act
            var acon = new AttributeControl(AttributeToReturn.WithName("foo"));

            //Assert
            Assert.That(acon, Is.Not.Null);
            Assert.That(acon.ToAdsml().ToString(), Is.EqualTo(expected));
        }
        public void Can_Generate_Api_Xml_With_Outer_Node_XAttributes()
        {
            //Arrange
            var expected = new XElement("AttributesToReturn", new XAttribute("foo", "bar"),
                                        new XElement("Attribute", new XAttribute("id", "20")));

            var asc = new AttributeControl(new AttributeToReturn {
                DefinitionId = 20
            })
            {
                OuterNodeAttributes = new List <XAttribute> {
                    new XAttribute("foo", "bar")
                }
            };

            //Act
            var actual = asc.ToAdsml();

            //Assert
            Assert.That(actual.ToString(), Is.EqualTo(expected.ToString()));
        }