示例#1
0
        public void Can_Generate_Api_Xml_With_RequestFilter()
        {
            //Arrange
            string expected =
                new XElement("LinkRequest",
                             new XAttribute("name", "foo"),
                             new XAttribute("targetLocation", "bar"),
                             new XAttribute("returnNoAttributes", "true")).ToString();

            var request = new LinkRequest("foo", "bar")
            {
                RequestFilters = new List <ILinkRequestFilter> {
                    Filter.ReturnNoAttributes()
                }
            };

            //Act
            var actual       = request.ToAdsml();
            var batchRequest = new BatchRequest(request);

            Console.WriteLine(actual.ToString());

            //Assert
            Assert.That(actual.ToString(), Is.EqualTo(expected));
            Assert.DoesNotThrow(() => batchRequest.ToAdsml().ValidateAdsmlDocument("adsml.xsd"));
        }
示例#2
0
        public void Can_Generate_Api_Xml_With_CopyControl()
        {
            //Arrange
            string expected =
                new XElement("LinkRequest",
                             new XAttribute("name", "foo"),
                             new XAttribute("targetLocation", "bar"),
                             new XElement("CopyControls",
                                          new XAttribute("copyLocalAttributes", "true"))).ToString();

            var request = new LinkRequest("foo", "bar")
            {
                CopyControl = new CopyControl(new List <ICopyControlFilter> {
                    Filter.CopyLocalAttributesFromSource()
                })
            };

            //Act
            var actual       = request.ToAdsml();
            var batchRequest = new BatchRequest(request);

            Console.WriteLine(actual.ToString());

            //Assert
            Assert.That(actual.ToString(), Is.EqualTo(expected));
            Assert.DoesNotThrow(() => batchRequest.ToAdsml().ValidateAdsmlDocument("adsml.xsd"));
        }
示例#3
0
        public void Validate_Throws_ApiSerializationValidationException_If_Target_Is_Empty()
        {
            //Arrange
            var req = new LinkRequest("foo", string.Empty);

            //Act
            req.ToAdsml();
        }