Exemple #1
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"));
        }
Exemple #2
0
        public void CanGenerateBasicApiXml()
        {
            //Arrange
            string expected = new XElement("LookupRequest", new XAttribute("name", "/foo/bar")).ToString();

            //Act
            var req          = new LookupRequest("/foo/bar");
            var actual       = req.ToAdsml();
            var batchRequest = new BatchRequest(req);

            Console.WriteLine(actual);

            //Assert
            Assert.That(actual.ToString(), Is.EqualTo(expected));
            Assert.DoesNotThrow(() => batchRequest.ToAdsml().ValidateAdsmlDocument("adsml.xsd"));
        }