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."); } }
public void TestGetUiWssAndInstall_OnlyEnglish() { var testStrings = new List <string> { "en", "es", "fr" }; using (var dlg = new TestCustomListDlg()) { dlg.SetTestCache(Cache); // must set the test cache because this method needs one SetUserWs("en"); // SUT var wss = dlg.GetUiWssAndInstall(testStrings); // Verify Assert.AreEqual(1, wss.Count, "Wrong number of wss found."); var fenglish = wss.Where(ws => ws.IcuLocale == "en").Any(); var fspanish = wss.Where(ws => ws.IcuLocale == "es").Any(); var ffrench = wss.Where(ws => ws.IcuLocale == "fr").Any(); Assert.IsTrue(fenglish, "English not found."); Assert.IsFalse(fspanish, "Spanish should not found."); Assert.IsFalse(ffrench, "French should not be found."); } }
public void SetDialogTitle_Add() { // AddList subclass of CustomListDlg using (var dlg = new TestCustomListDlg()) { // Dialog Title should default to "New List" Assert.AreEqual("New List", dlg.Text, "Dialog default title for AddList dialog is wrong."); } }
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."); } }
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?!"); } }
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?!"); } }
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?!"); } }
public void TestGetUiWssAndInstall_OnlyEnglish() { var testStrings = new List<string> { "en", "es", "fr" }; using (var dlg = new TestCustomListDlg()) { dlg.SetTestCache(Cache); // must set the test cache because this method needs one SetUserWs("en"); // SUT var wss = dlg.GetUiWssAndInstall(testStrings); // Verify Assert.AreEqual(1, wss.Count, "Wrong number of wss found."); var fenglish = wss.Where(ws => ws.IcuLocale == "en").Any(); var fspanish = wss.Where(ws => ws.IcuLocale == "es").Any(); var ffrench = wss.Where(ws => ws.IcuLocale == "fr").Any(); Assert.IsTrue(fenglish, "English not found."); Assert.IsFalse(fspanish, "Spanish should not found."); Assert.IsFalse(ffrench, "French should not be found."); } }
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."); } }
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."); } }
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?!"); } }