public void CreateNominativeGeneratesRandomNumber()
        {
            NounInstance  sut  = new NounInstance();
            NounGenerator sut2 = new NounGenerator();

            sut = sut2.CreateNominativeInstance();

            Assert.IsTrue(sut.Number == Number.Singular || sut.Number == Number.Plural);
        }
        public void CreateNominativeGeneratesRandomGenderNumeric()
        {
            NounInstance  sut  = new NounInstance();
            NounGenerator sut2 = new NounGenerator();

            sut = sut2.CreateNominativeInstance();

            Assert.IsTrue((int)sut.Gender >= 0 && (int)sut.Gender < 3);
        }
        public void CreateNominativeGeneratesRandomGender()
        {
            NounInstance  sut  = new NounInstance();
            NounGenerator sut2 = new NounGenerator();

            sut = sut2.CreateNominativeInstance();

            Assert.IsTrue(sut.Gender == Gender.Masculine || sut.Gender == Gender.Feminine || sut.Gender == Gender.Neuter);
        }
        public void CreateNominativeReturnsNominativeNoun()
        {
            NounInstance  sut  = new NounInstance();
            NounGenerator sut2 = new NounGenerator();

            sut = sut2.CreateNominativeInstance();

            Assert.AreEqual(sut.Case, Case.Nominative);
        }
        public NounInstance CreateAccusativeInstance(List <Word> sentence = null)
        {
            // Pick a random noun from the word-list (principal parts, declension, meaning, etc.)
            Noun = vocabList.GetRandomNoun();

            // Fill out other noun elements (gender, number, case)
            Noun.Number = GetRandomNumber();
            Noun.Case   = Case.Accusative;
            return(Noun);
        }
Esempio n. 6
0
 public bool ContainsNominative()
 {
     foreach (Word word in sentence)
     {
         if (word.PartOfSpeech == PartOfSpeech.Noun)
         {
             NounInstance temp = word as NounInstance;
             if (temp.Case == Case.Nominative)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        public NounInstance GetRandomNoun()
        {
            int          index    = rnd.Next(0, nouns.Count - 1);
            Noun         tempNoun = nouns[index];
            NounInstance toReturn = new NounInstance();

            toReturn.Declension          = tempNoun.Declension;
            toReturn.Gender              = tempNoun.Gender;
            toReturn.FirstPrincipalPart  = tempNoun.FirstPrincipalPart;
            toReturn.SecondPrincipalPart = tempNoun.SecondPrincipalPart;
            toReturn.PartOfSpeech        = tempNoun.PartOfSpeech;
            toReturn.Meaning             = tempNoun.Meaning;

            return(toReturn);
        }