Beispiel #1
0
 public void Test01()
 {
     Assert.AreEqual("Иванов", petrovich.Inflect("Иванов", NamePart.LastName, Case.Nominative, Gender.Male));
     Assert.AreEqual("Иванова", petrovich.Inflect("Иванов", NamePart.LastName, Case.Genitive, Gender.Male));
     Assert.AreEqual("Иванову", petrovich.Inflect("Иванов", NamePart.LastName, Case.Dative, Gender.Male));
     Assert.AreEqual("Иванова", petrovich.Inflect("Иванов", NamePart.LastName, Case.Accusative, Gender.Male));
     Assert.AreEqual("Ивановым", petrovich.Inflect("Иванов", NamePart.LastName, Case.Instrumental, Gender.Male));
     Assert.AreEqual("Иванове", petrovich.Inflect("Иванов", NamePart.LastName, Case.Prepositional, Gender.Male));
 }
        public void Test01()
        {
            Petrovich.FIO fio = new Petrovich.FIO()
            {
                lastName  = "Иванов",
                firstName = "Иван",
                midName   = "Иванович"
            };

            Petrovich.FIO result = petrovich.Inflect(fio, Case.Nominative);
            Assert.AreEqual(fio, result);

            result = petrovich.Inflect(fio, Case.Genitive);
            Assert.AreEqual("Иванова", result.lastName);
            Assert.AreEqual("Ивана", result.firstName);
            Assert.AreEqual("Ивановича", result.midName);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            //NPetrovichLite.Tests.TestDataFactory.ReadSurnamesData().OfType<object[]>().ToList();

            //Petrovich petrovich = new Petrovich(@"..\..\..\rules\rules.json", @"..\..\..\rules\gender.json");

            /*
             * Petrovich petrovich = new Petrovich();
             * Console.WriteLine(petrovich.Inflect("Маша", NamePart.FirstName, Case.Dative));
             * Console.WriteLine(petrovich.Inflect("Паша", NamePart.FirstName, Case.Dative));
             * Console.WriteLine(petrovich.Inflect("Саша", NamePart.FirstName, Case.Dative, Gender.Female));
             */

            /*
             * Petrovich petrovich = new Petrovich();
             * Petrovich.FIO a = petrovich.Inflect(new Petrovich.FIO() { lastName = "Пушкин", firstName = "Александр", midName = "Сергеевич" }, Case.Dative);
             * Console.WriteLine(a);
             * Petrovich.FIO b = petrovich.Inflect(new Petrovich.FIO() { lastName = "Воробей" }, Case.Dative, Gender.Female);
             * Console.WriteLine(b);
             * Petrovich.FIO c = petrovich.Inflect(new Petrovich.FIO() { lastName = "Воробей", firstName = "Александр" }, Case.Dative);
             * Console.WriteLine(c);
             */

            /*
             * Petrovich petrovich = new Petrovich();
             * Console.WriteLine(petrovich.GetGender("Пушкин", NamePart.LastName));
             * Console.WriteLine(petrovich.GetGender("Пушкин", null, "Сергеевич"));
             * Console.WriteLine(petrovich.GetGender(new Petrovich.FIO() { lastName = "Воробей", firstName = "Александр" }));
             */

            /*
             * InflectSinglePart testFixture = new InflectSinglePart();
             * testFixture.Init();
             * MethodInfo mi = testFixture.GetType().GetMethod(nameof(InflectSinglePart.TestSinglePartInflection));
             * foreach (object[] par in TestDataFactory.ReadSurnamesData())
             * {
             *  mi.Invoke(testFixture, par);
             * }
             */

            Petrovich petrovich = new Petrovich();

            Console.WriteLine(petrovich.Inflect("Aгриппа", NamePart.LastName, Case.Genitive));
            Console.WriteLine(petrovich.Inflect("Кваша", NamePart.LastName, Case.Genitive));
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            //NPetrovichLite.Tests.TestDataFactory.ReadSurnamesData().OfType<object[]>().ToList();

            //Petrovich petrovich = new Petrovich(@"c:\Dev\_Projects\petrovich-net\src\rules\rules.json");
            /*
            Petrovich petrovich = new Petrovich();
            Console.WriteLine(petrovich.Inflect("Маша", NamePart.FirstName, Case.Dative));
            Console.WriteLine(petrovich.Inflect("Паша", NamePart.FirstName, Case.Dative));
            Console.WriteLine(petrovich.Inflect("Саша", NamePart.FirstName, Case.Dative, Gender.Female));
            */

            /*
            Petrovich petrovich = new Petrovich();
            Petrovich.FIO a = petrovich.Inflect(new Petrovich.FIO() { lastName = "Пушкин", firstName = "Александр", midName = "Сергеевич" }, Case.Dative);
            Console.WriteLine(a);
            Petrovich.FIO b = petrovich.Inflect(new Petrovich.FIO() { lastName = "Воробей" }, Case.Dative, Gender.Female);
            Console.WriteLine(b);
            Petrovich.FIO c = petrovich.Inflect(new Petrovich.FIO() { lastName = "Воробей", firstName = "Александр" }, Case.Dative);
            Console.WriteLine(c);
            */

            /*
            Petrovich petrovich = new Petrovich();
            Console.WriteLine(petrovich.GetGender("Пушкин", NamePart.LastName));
            Console.WriteLine(petrovich.GetGender("Пушкин", null, "Сергеевич"));
            Console.WriteLine(petrovich.GetGender(new Petrovich.FIO() { lastName = "Воробей", firstName = "Александр" }));
            */

            /*
            InflectSinglePart testFixture = new InflectSinglePart();
            testFixture.Init();
            MethodInfo mi = testFixture.GetType().GetMethod(nameof(InflectSinglePart.TestSinglePartInflection));
            foreach (object[] par in TestDataFactory.ReadSurnamesData())
            {
                mi.Invoke(testFixture, par);
            }
            */

            Petrovich petrovich = new Petrovich();
            //Console.WriteLine(petrovich.Inflect("Aгриппа", NamePart.LastName, Case.Genitive));
            Console.WriteLine(petrovich.Inflect("Кваша", NamePart.LastName, Case.Genitive));
        }