Exemplo n.º 1
0
        public void Can_Build_Api_Xml()
        {
            //Arrange
            string expected = new XElement("DeleteRequest", new XAttribute("name", "foo")).ToString();

            //Act
            var deleteRequest = new DeleteRequest("foo");
            var batchRequest  = new BatchRequest(deleteRequest);
            var actual        = deleteRequest.ToAdsml();

            Console.WriteLine(actual);

            //Assert
            Assert.That(actual.ToString(), Is.EqualTo(expected));
            Assert.DoesNotThrow(() => batchRequest.ToAdsml().ValidateAdsmlDocument("adsml.xsd"));
        }
Exemplo n.º 2
0
        public void Throws_InvalidOperationException_If_ContextToDelete_Is_Not_Set()
        {
            //Arrange
            var request1 = new DeleteRequest(string.Empty);
            var request2 = new DeleteRequest(null);

            //Act
            try {
                request1.ToAdsml();
            }
            catch (InvalidOperationException) {
            }
            catch (Exception) {
                Assert.Fail();
            }

            request2.ToAdsml();
        }