Пример #1
0
        public void SetGetListDescription()
        {
            // Setup
            using (var dlg = new TestCustomListDlg())
            {
                dlg.SetTestCache(Cache);
                var wsFr = Cache.WritingSystemFactory.GetWsFromStr("fr");
                Assert.True(wsFr > 0, "Test failed because French ws is not installed.");
                var wsSp = Cache.WritingSystemFactory.GetWsFromStr("es");
                Assert.True(wsSp > 0, "Test failed because Spanish ws is not installed.");
                dlg.InitializeMultiString();
                // setup up multistring controls
                var nameTssFr = TsStringUtils.MakeString("Une description en français!", wsFr);
                var nameTssSp = TsStringUtils.MakeString("Un descripción en español?", wsSp);

                // SUT (actually tests both Set and Get)
                dlg.SetDescriptionForWs(nameTssFr, wsFr);
                dlg.SetDescriptionForWs(nameTssSp, wsSp);

                Assert.AreEqual("Une description en français!", dlg.GetDescriptionForWs(wsFr).Text,
                                "Setting the custom list Description in French failed.");
                Assert.AreEqual("Un descripción en español?", dlg.GetDescriptionForWs(wsSp).Text,
                                "Setting the custom list Description in Spanish failed.");
            }
        }
Пример #2
0
        public void SetGetListName()
        {
            // Setup
            using (var dlg = new TestCustomListDlg())
            {
                dlg.SetTestCache(Cache);
                var wsFr = Cache.WritingSystemFactory.GetWsFromStr("fr");
                Assert.True(wsFr > 0, "Test failed because French ws is not installed.");
                dlg.InitializeMultiString();
                // setup up multistring controls
                var nameTss = TsStringUtils.MakeString("Gens", wsFr);

                // SUT (actually tests both Set and Get)
                dlg.SetListNameForWs(nameTss, wsFr);

                Assert.AreEqual("Gens", dlg.GetListNameForWs(wsFr).Text, "Setting the custom list Name failed.");
            }
        }
Пример #3
0
        public void IsListNameDuplicated_French_No()
        {
            // Setup
            using (var dlg = new TestCustomListDlg())
            {
                dlg.SetTestCache(Cache);
                SetUserWs("fr");                 // user ws needs to be French for this test
                var wsFr = Cache.WritingSystemFactory.GetWsFromStr("fr");
                Assert.True(wsFr > 0, "Test failed because French ws is not installed.");
                dlg.InitializeMultiString();
                // setup up multistring controls
                var nameTss = TsStringUtils.MakeString("Gens-test", wsFr);
                // set dialog list name French alternative to "Gens-test", but don't create a list
                // with that name.
                dlg.SetListNameForWs(nameTss, wsFr);

                // SUT
                bool fdup = dlg.IsNameDuplicated;

                Assert.IsFalse(fdup, "Detected a list with duplicate French name?!");
            }
        }
Пример #4
0
        public void IsListNameDuplicated_French_Yes()
        {
            // Setup
            using (var dlg = new TestCustomListDlg())
            {
                dlg.SetTestCache(Cache);
                SetUserWs("fr");                 // user ws needs to be French for this test
                var wsFr = Cache.WritingSystemFactory.GetWsFromStr("fr");
                Assert.True(wsFr > 0, "Test failed because French ws is not installed.");
                dlg.InitializeMultiString();
                // setup up multistring controls
                var nameTss = TsStringUtils.MakeString("Gens-test", wsFr);
                var newList = Cache.ServiceLocator.GetInstance <ICmPossibilityListFactory>().CreateUnowned(
                    "testPeople", Cache.DefaultUserWs);
                newList.Name.set_String(wsFr, nameTss);
                // set French alternative in new list to "Gens-test"
                dlg.SetListNameForWs(nameTss, wsFr);
                // set dialog list name French alternative to the same thing

                // SUT
                bool fdup = dlg.IsNameDuplicated;
                Assert.IsTrue(fdup, "Couldn't detect list with duplicate French name?!");
            }
        }
Пример #5
0
        public void IsListNameDuplicated_French_No()
        {
            // Setup
            using (var dlg = new TestCustomListDlg())
            {
                dlg.SetTestCache(Cache);
                SetUserWs("fr"); // user ws needs to be French for this test
                var wsFr = Cache.WritingSystemFactory.GetWsFromStr("fr");
                Assert.True(wsFr > 0, "Test failed because French ws is not installed.");
                dlg.InitializeMultiString();
                // setup up multistring controls
                var nameTss = Cache.TsStrFactory.MakeString("Gens-test", wsFr);
                // set dialog list name French alternative to "Gens-test", but don't create a list
                // with that name.
                dlg.SetListNameForWs(nameTss, wsFr);

                // SUT
                bool fdup = dlg.IsNameDuplicated;

                Assert.IsFalse(fdup, "Detected a list with duplicate French name?!");
            }
        }
Пример #6
0
        public void SetGetListName()
        {
            // Setup
            using (var dlg = new TestCustomListDlg())
            {
                dlg.SetTestCache(Cache);
                var wsFr = Cache.WritingSystemFactory.GetWsFromStr("fr");
                Assert.True(wsFr > 0, "Test failed because French ws is not installed.");
                dlg.InitializeMultiString();
                // setup up multistring controls
                var nameTss = Cache.TsStrFactory.MakeString("Gens", wsFr);

                // SUT (actually tests both Set and Get)
                dlg.SetListNameForWs(nameTss, wsFr);

                Assert.AreEqual("Gens", dlg.GetListNameForWs(wsFr).Text, "Setting the custom list Name failed.");
            }
        }
Пример #7
0
        public void SetGetListDescription()
        {
            // Setup
            using (var dlg = new TestCustomListDlg())
            {
                dlg.SetTestCache(Cache);
                var wsFr = Cache.WritingSystemFactory.GetWsFromStr("fr");
                Assert.True(wsFr > 0, "Test failed because French ws is not installed.");
                var wsSp = Cache.WritingSystemFactory.GetWsFromStr("es");
                Assert.True(wsSp > 0, "Test failed because Spanish ws is not installed.");
                dlg.InitializeMultiString();
                // setup up multistring controls
                var nameTssFr = Cache.TsStrFactory.MakeString("Une description en français!", wsFr);
                var nameTssSp = Cache.TsStrFactory.MakeString("Un descripción en español?", wsSp);

                // SUT (actually tests both Set and Get)
                dlg.SetDescriptionForWs(nameTssFr, wsFr);
                dlg.SetDescriptionForWs(nameTssSp, wsSp);

                Assert.AreEqual("Une description en français!", dlg.GetDescriptionForWs(wsFr).Text,
                    "Setting the custom list Description in French failed.");
                Assert.AreEqual("Un descripción en español?", dlg.GetDescriptionForWs(wsSp).Text,
                "Setting the custom list Description in Spanish failed.");
            }
        }
Пример #8
0
        public void IsListNameDuplicated_French_Yes()
        {
            // Setup
            using (var dlg = new TestCustomListDlg())
            {
                dlg.SetTestCache(Cache);
                SetUserWs("fr"); // user ws needs to be French for this test
                var wsFr = Cache.WritingSystemFactory.GetWsFromStr("fr");
                Assert.True(wsFr > 0, "Test failed because French ws is not installed.");
                dlg.InitializeMultiString();
                // setup up multistring controls
                var nameTss = Cache.TsStrFactory.MakeString("Gens-test", wsFr);
                var newList = Cache.ServiceLocator.GetInstance<ICmPossibilityListFactory>().CreateUnowned(
                    "testPeople", Cache.DefaultUserWs);
                newList.Name.set_String(wsFr, nameTss);
                // set French alternative in new list to "Gens-test"
                dlg.SetListNameForWs(nameTss, wsFr);
                // set dialog list name French alternative to the same thing

                // SUT
                bool fdup = dlg.IsNameDuplicated;
                Assert.IsTrue(fdup, "Couldn't detect list with duplicate French name?!");
            }
        }