static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; SetNewRules(); string name = "яна Кравінський Василь Олександрович"; Transliter tr = new Transliter(); Console.WriteLine(name); Console.WriteLine(); Console.WriteLine("Translit with dafault rules:"); Console.WriteLine(tr.Translit(name)); Console.WriteLine(); Console.WriteLine("Translit with custom rules:"); tr.SetNewRules(rules); Console.WriteLine(tr.Translit(name)); Console.WriteLine(); Console.WriteLine("Translit with custom rules and modefided rule \"a\" - \"+_+\" :"); tr.ModifyRule("а", "+_+"); Console.WriteLine(tr.Translit(name)); Console.ReadKey(); }
public void ModifyRuleSimple() { string ukr = "а"; string lat = "b"; Transliter t = new Transliter(); t.ModifyRule("а", "b"); string actual = t.Translit(ukr); Assert.AreEqual(lat, t.Translit(ukr)); }
public void Translit_LognString_Correct() { string ukr = "|Єнакієве |Гаєвич |Короп’є Згорани Розгон |Юрій |Корюківка"; string lat = "|Yenakiieve |Haievych |Koropie Zghorany Rozghon |Yurii |Koriukivka"; Transliter t = new Transliter(); string actual = t.Translit(ukr); Assert.AreEqual(lat, actual); }
public void Translit_EmptyString_Correct() { string ukr = ""; string lat = ""; Transliter t = new Transliter(); string actual = t.Translit(ukr); Assert.AreEqual(lat, actual); }
public void Translit_UkrLat_Correct() { string ukr = "Василь"; string lat = "Vasyl"; Transliter t = new Transliter(); string actual = t.Translit(ukr); Assert.AreEqual(lat, actual); }
private void ToTranslitButton_Click(object sender, RoutedEventArgs e) { try { Language language = languageIdentifier.GetLanguage(originalValue.Text); transliter = Transliter.GetTransliter(language); translitValue.Text = transliter.Translit(originalValue.Text); } catch (ArgumentException) { MessageBox.Show("Недопустимая строка, воспользуйтесь справкой"); } }
public void TestWrongLatToCyr(string symbolToTranslit) { Transliter transliter = new Transliter(); Assert.Throws <Exception>(() => transliter.Translit(symbolToTranslit)); }
public void TestLatToCyr(string expectedResult, string symbolToTranslit) { Transliter transliter = new Transliter(); Assert.AreEqual(expectedResult, transliter.Translit(symbolToTranslit)); }