Example #1
0
        public void ClonedGadgetHasExternalMessages()
        {
            GadgetMaster master = GadgetMaster.CreateGadget(TEST_FACTORY_KEY, testData.Source);

            //This takes a long time.  Manual add of info instead.
            //GadgetProvider.FetchExternalMessageBundles(master);

            MessageBundleData.LoadSampleMessageBundles(master);


            string[] cultures = master.MyDataContext.ResourceStringCatalog.GetDefinedCultures();
            string   cult     = "";

            for (int i = 0; i < cultures.Length; i++)
            {
                cult += "|" + cultures[i];
            }
            Assert.IsTrue(cult.Contains("ru"));
            Assert.IsTrue(cult.Contains("fr"));


            Assert.IsTrue(master.HasExternalMessageBundles(), "External bundles not defined in main gadget");
            Assert.Greater(master.MasterDataContext.ResourceStringCatalog.GetDefinedCultures().Length, 0, "No locales defined in main gadget");

            GadgetMaster target = master.Clone() as GadgetMaster;

            Assert.IsNotNull(target);
            Assert.IsTrue(target.HasExternalMessageBundles(), "Clone has no bundles");
            Assert.Greater(target.MasterDataContext.ResourceStringCatalog.GetDefinedCultures().Length, 0, "No locales defined in clone gadget");

            string allMessages = master.GetConsolidatedMessageBundles();
        }