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

            var request = new MoveRequest("foo", "bar")
            {
                RequestFilters = new List <IMoveRequestFilter> {
                    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"));
        }
Beispiel #2
0
        public void Can_Generate_Api_Xml_With_CopyControl()
        {
            //Arrange
            string expected =
                new XElement("MoveRequest",
                             new XAttribute("name", "foo"),
                             new XAttribute("targetLocation", "bar"),
                             new XElement("CopyControls",
                                          new XAttribute("copyLocalAttributes", "true"))).ToString();

            var request = new MoveRequest("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"));
        }
Beispiel #3
0
        public void Validate_Throws_ApiSerializationValidationException_If_Target_Is_Empty()
        {
            //Arrange
            var req = new MoveRequest("foo", string.Empty);

            //Act
            req.ToAdsml();
        }