Exemplo n.º 1
0
        public void GetTermsAndConditionsTest()
        {
            ContentAPI client = ConstructServiceClient();

            XDocument terms = client.GetTermsAndConditions();

            Assert.IsNotNull(terms);

            Assert.IsNotNull(terms.Element("html"));
            Assert.IsNotNull(terms.Element("html").Element("head"));
            Assert.IsNotNull(terms.Element("html").Element("head"));
        }
Exemplo n.º 2
0
        public void AuthorizationTest()
        {
            ContentAPI client = new ContentAPI(keyId: "aZqpaIZkYRfPFrtUWiyq", secretKey: "", endpoint: new Uri("https://developer-sandbox.liondemand.com"));

            try
            {
                XDocument terms = client.GetTermsAndConditions();
                Assert.Fail("A request without a secret key should not be sucessful.");
            }
            catch (OnDemandClientException odce)
            {
                Assert.AreEqual <HttpStatusCode>(HttpStatusCode.Unauthorized, odce.HttpStatusCode);
                Assert.AreEqual <Int32>(0, odce.ReasonCode);
                Assert.IsNotNull(odce.SimpleMessage);
                Assert.IsNotNull(odce.DetailedMessage);

                throw;
            }
        }