Esempio n. 1
0
        public void FamilyNameFormShouldChangeToGenitiveCorrectly_ForFemales(string nominative, string genitive,
                                                                             Gender nameGender)
        {
            var nh = new PolishNameFlectionHelper();

            Assert.Equal(genitive, nh.GetFamilyNameInGenitiveForm(nominative, nameGender));
        }
        public void NameFormShouldChangeToGenitiveCorrectly_ForFemales(string nominative, string genitive, Gender nameGender)
        {
            var nh = new PolishNameFlectionHelper();

            Assert.Equal(genitive, nh.GetFirstName(nominative, Case.Genitive)); // new interface
            Assert.Equal(genitive, nh.GetFirstNameInGenitiveForm(nominative));  // obsolete interface
        }
        private static void Main(string[] args)
        {
            var testedName = "Adam";
            IPolishNameFlectionHelper helper = new PolishNameFlectionHelper();
            string modifiedName = helper.GetFirstName(testedName, Case.Genitive);

            Debug.Assert(modifiedName == "Adama");
            Console.WriteLine($"Name '{testedName}' was successfuly converted to '{modifiedName}' by the library.");
            Console.ReadKey();
        }
Esempio n. 4
0
        public MainPage()
        {
            this.InitializeComponent();

            var testedName = "Adam";
            IPolishNameFlectionHelper helper = new PolishNameFlectionHelper();
            string modifiedName = helper.GetFirstName(testedName, Case.Genitive);

            TextToDisplay.Text = $"Modified text: {modifiedName}";
        }
        public void GenderShouldBeRecognizedCorrectly_ForNamesInExceptionList()
        {
            var nh = new PolishNameFlectionHelper();

            Assert.Equal(Gender.Female, nh.RecognizeGender("Beatrycze"));

            Assert.Equal(Gender.Male, nh.RecognizeGender("Barnaba"));
            Assert.Equal(Gender.Male, nh.RecognizeGender("Kuba"));
            Assert.Equal(Gender.Male, nh.RecognizeGender("Bonawentura"));
            Assert.Equal(Gender.Male, nh.RecognizeGender("Kosma"));
        }
        /// <summary>
        ///     Simple program targeting .NET Core RC2 to test library combatilbility with .NET projects
        /// </summary>
        public static void Main(string[] args)
        {
            var testedName = "Adam";
            IPolishNameFlectionHelper helper = new PolishNameFlectionHelper();
            string modifiedName = helper.GetFirstName(testedName, Case.Genitive);

            Debug.Assert(modifiedName == "Adama");
            Console.WriteLine($"Name '{testedName}' was successfuly converted to '{modifiedName}' by the library.");
            Console.ReadKey();

            // Also, test whether code example from documentation compiles and runs correctly:
            CodeExample();

            Console.ReadKey();
        }
        /// <summary>
        /// Example of library usage, for use in Readme file
        /// </summary>
        private static void CodeExample()
        {
            IPolishNameFlectionHelper helper = new PolishNameFlectionHelper();

            string nameInGenitive1 = helper.GetFirstName("Wiktoria Weronika", Case.Genitive);
            // -> Wiktorii Weroniki

            string nameInGenitive2 = helper.GetFirstName("Hugo", Case.Genitive);
            // -> Hugona

            string secondNameInGenitive1 = helper.GetFamilyName("Lewandowska", Gender.Female, Case.Genitive);
            // -> Lewandowskiej

            string secondNameInGenitive2 = helper.GetFamilyName("Lewandowski", Gender.Male, Case.Genitive);
            // -> Lewandowskiego
        }
Esempio n. 8
0
        public void ChangeToSupportedCase_DoesNotThrow(Case testedCase)
        {
            var nh = new PolishNameFlectionHelper();

            nh.GetFirstName("Adam", testedCase);
        }
Esempio n. 9
0
        public void ChangeToUnsupportedCase_ReturnsClearException(Case testedCase)
        {
            var nh = new PolishNameFlectionHelper();

            Assert.Throws <NotSupportedException>(() => nh.GetFirstName("Adam", testedCase));
        }
        public void GenderShouldBeRecognizedCorrectly_ForRegularMaleNames(string firstName)
        {
            var nh = new PolishNameFlectionHelper();

            Assert.Equal(Gender.Male, nh.RecognizeGender(firstName));
        }