public void Can_Specify_AttributeNamelist_And_AttributesToReturn()
        {
            //Arrange
            string expected =
                new XElement("LookupControls",
                             new XElement("AttributesToReturn",
                                          new XAttribute("namelist", "members"),
                                          new XElement("Attribute",
                                                       new XAttribute("name", "35")),
                                          new XElement("Attribute",
                                                       new XAttribute("name", "36")))).ToString();

            var builder = new LookupControlBuilder();

            //Act
            builder
            .AttributeNamelist("members")
            .ReturnAttributes(
                AttributeToReturn.WithName("35"),
                AttributeToReturn.WithName("36")
                );

            var actual = builder.Build().ToAdsml().ToString();

            Console.WriteLine(actual);

            //Assert
            Assert.That(actual, Is.EqualTo(expected));
        }
Exemple #2
0
        public void CanGenerateApiXmlWithLookupControl()
        {
            //Arrange
            string expexcted =
                new XElement("LookupRequest",
                             new XAttribute("name", "/Schema/Attribute Sets/Översättningsattribut"),
                             new XElement("LookupControls",
                                          new XElement("AttributesToReturn",
                                                       new XAttribute("namelist", "members")),
                                          new XElement("LanguagesToReturn",
                                                       new XElement("Language",
                                                                    new XAttribute("id", "10"))))).ToString();

            var lookupBuilder = new LookupControlBuilder();

            lookupBuilder.AttributeNamelist("members").ReturnLanguages(LanguageToReturn.WithLanguageId(10));

            //Act
            var req          = new LookupRequest("/Schema/Attribute Sets/Översättningsattribut", lookupBuilder.Build());
            var actual       = req.ToAdsml();
            var batchRequest = new BatchRequest(req);

            Console.WriteLine(actual);

            //Assert
            Assert.That(actual.ToString(), Is.EqualTo(expexcted));
            Assert.DoesNotThrow(() => batchRequest.ToAdsml().ValidateAdsmlDocument("adsml.xsd"));
        }
        public void Can_Specify_Attribute_IdList_And_NameList_To_Return()
        {
            //Arrange
            string expected =
                new XElement("LookupControls",
                             new XElement("AttributesToReturn",
                                          new XAttribute("namelist", "1, 2, 3, 4"),
                                          new XAttribute("idlist", "1, 2, 3, 4"))).ToString();

            var builder = new LookupControlBuilder();

            //Act
            builder
            .AttributeNamelist("1, 2, 3, 4")
            .ReturnAttributes(1, 2, 3, 4);

            var actual = builder.Build().ToAdsml().ToString();

            Console.WriteLine(actual);

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