예제 #1
0
        public void GetFileTranslationTest()
        {
            ContentAPI         client = ConstructServiceClient();
            IEnumerable <File> files  = client.ListFiles();

            foreach (File file in files)
            {
                int    assetID      = file.AssetID;
                String languageCode = "en-us";

                try
                {
                    Byte[] content = client.GetFileTranslation(assetID.ToString(), languageCode);
                    Assert.Fail("A file with an invalid translation should not have been retrieved.");
                }
                catch (OnDemandClientException odce)
                {
                    Assert.AreEqual <HttpStatusCode>(HttpStatusCode.NotFound, odce.HttpStatusCode);
                    Assert.AreEqual <Int32>(0, odce.ReasonCode);
                    Assert.IsNotNull(odce.SimpleMessage);
                }

                break;
            }
        }
예제 #2
0
        public void GetFileTranslationValidEmptyTest()
        {
            String     assetID      = "1234";
            String     languageCode = String.Empty;
            ContentAPI client       = ConstructServiceClient();

            Byte[] content = client.GetFileTranslation(assetID, languageCode);
        }
예제 #3
0
        public void GetFileTranslationNullTest()
        {
            String     assetID      = null;
            String     languageCode = "en-us";
            ContentAPI client       = ConstructServiceClient();

            Byte[] content = client.GetFileTranslation(assetID, languageCode);
        }
예제 #4
0
        public void GetFileTranslationUnknownTest()
        {
            String     assetID      = "0";
            String     languageCode = "en-us";
            ContentAPI client       = ConstructServiceClient();

            try
            {
                Byte[] content = client.GetFileTranslation(assetID, languageCode);
                Assert.Fail("A file with an invalid Asset ID should not have been retrieved.");
            }
            catch (OnDemandClientException odce)
            {
                Assert.AreEqual <HttpStatusCode>(HttpStatusCode.NotFound, odce.HttpStatusCode);
                Assert.AreEqual <Int32>(0, odce.ReasonCode);
                Assert.IsNotNull(odce.SimpleMessage);
            }
        }