Пример #1
0
        static void NounSamples()
        {
            {
                Console.WriteLine("Поиск существительного по точному совпадению с автоматическим определением рода, падежа и числа.");
                CyrNoun noun = cyrNounCollection.Get("компьютер", out CasesEnum @case, out NumbersEnum number);
                WriteToConsole(noun);
            }

            {
                Console.WriteLine("Поиск существительного по неточному совпадению с автоматическим определением рода, падежа и числа.");
                CyrNoun noun = cyrNounCollection.Get("трипьютер", out string foundWord, out CasesEnum @case, out NumbersEnum number);
                WriteToConsole(noun, foundWord);
            }

            {
                Console.WriteLine("Поиск существительного по точному совпадению с указанием рода, падежа и числа.");
                CyrNoun noun = cyrNounCollection.Get("кошка", GendersEnum.Feminine, CasesEnum.Nominative, NumbersEnum.Singular);
                WriteToConsole(noun);
            }

            {
                Console.WriteLine("Поиск существительного по неточному совпадению с указанием рода, падежа и числа.");
                CyrNoun noun = cyrNounCollection.GetOrDefault("фошки", out string foundWord, GendersEnum.Feminine, CasesEnum.Genitive, NumbersEnum.Singular);
                WriteToConsole(noun, foundWord);
            }
        }
Пример #2
0
        public void Nouns()
        {
            int speechPartNountID            = 1;
            CyrNounCollection nounCollection = new CyrNounCollection();
            CyrillerEntities  mainDB         = new CyrillerEntities();
            int         count = mainDB.Words.Where(x => x.SpeechPartID == speechPartNountID).Count();
            int         step  = 1000;
            List <Task> tasks = new List <Task>();

            mainDB.Dispose();

            for (int i = 0; i < count; i += step)
            {
                int skip = i;

                tasks.Add(Task.Run(() =>
                {
                    CyrillerEntities db     = new CyrillerEntities();
                    IQueryable <Word> words = db.Words.Where(x => x.SpeechPartID == speechPartNountID).OrderBy(x => x.ID).Skip(skip).Take(step);

                    foreach (Word word in words)
                    {
                        CyrNoun noun = nounCollection.Get(word.Name, GetConditionsEnum.Strict, (GendersEnum?)word.GenderID, (AnimatesEnum?)word.AnimateID, (WordTypesEnum?)word.TypeID);

                        Assert.NotNull(noun);
                        Assert.Equal(word.GenderID ?? 0, (int?)noun.Gender ?? 0);
                        Assert.Equal(word.AnimateID ?? 0, (int?)noun.Animate ?? 0);
                        Assert.Equal(word.TypeID ?? 0, (int?)noun.WordType ?? 0);

                        CyrResult result = noun.Decline();

                        Assert.NotNull(result);

                        for (int caseID = 1; caseID < 7; caseID++)
                        {
                            WordCase[] wordCases = word.WordCases.Where(x => x.CaseID == caseID && x.NumberID == 1).ToArray();

                            if (!wordCases.Any())
                            {
                                Assert.True(caseID == 1 || string.IsNullOrEmpty(result[caseID]), $"{word.ID}|{caseID} - {word.Name} - {result[caseID]}");
                            }
                            else
                            {
                                Assert.True(wordCases.Any(x => string.Compare(x.Name, result[caseID], true) == 0), $"{word.ID}|{caseID} - {word.Name} - {result[caseID]}");
                            }
                        }
                    }

                    db.Dispose();
                }));
            }

            Task.WaitAll(tasks.ToArray());
        }
Пример #3
0
        static void WriteToConsole(CyrNoun noun, string foundWord = null)
        {
            Console.WriteLine($"{noun.Name}");

            if (!string.IsNullOrWhiteSpace(foundWord) && !string.Equals(noun.Name, foundWord, StringComparison.InvariantCulture))
            {
                Console.Write(" - слово в словаре: ");
                Console.WriteLine(foundWord);
            }

            switch (noun.Gender)
            {
            case GendersEnum.Feminine:
                Console.WriteLine(" - женский род");
                break;

            case GendersEnum.Masculine:
                Console.WriteLine(" - мужской род");
                break;

            case GendersEnum.Neuter:
                Console.WriteLine(" - нейтральный род");
                break;
            }

            if (noun.IsAnimated)
            {
                Console.WriteLine(" - одушевленный предмет");
            }
            else
            {
                Console.WriteLine(" - неодушевленный предмет");
            }

            Console.Write(" - Единственное число: ");
            Console.WriteLine(string.Join(", ", noun.Decline().ToArray()));

            Console.Write(" - Множественное число: ");
            Console.WriteLine(string.Join(", ", noun.DeclinePlural().ToArray()));

            Console.WriteLine();
        }
Пример #4
0
        static void Main(string[] args)
        {
            // Создаем генератор случайных чисел.
            Random rand = new Random();

            // Создаем склонятор чисел.
            CyrNumber number = new CyrNumber();

            {
                // Склоняем случайное число.
                CyrResult result = number.Decline(5300);
                Console.WriteLine(result.ToRussianStringDictionary());
            }

            {
                // Склоняем случайное количество рублей.
                // Так же можно использовать классы `CyrNumber.EurCurrency`, `CyrNumber.UsdCurrency` и `CyrNumber.YuanCurrency`.
                // Либо создать свой класс унаследовав его от `CyrNumber.Currency`.
                CyrNumber.Currency currency = new CyrNumber.RurCurrency();
                CyrResult          result   = number.Decline((decimal)5300, currency);
            }

            {
                // Создаем коллекцию всех существительных.
                CyrNounCollection nouns = new CyrNounCollection();

                // Получаем существительное из коллекции используя точное совпадение.
                CyrNoun noun = nouns.Get("компьютер", GetConditionsEnum.Strict);

                // Упаковываем существительное для склонения количества.
                CyrNumber.Item item = new CyrNumber.Item(noun);

                // Склоняем случайное количество компьютеров.
                CyrResult result = number.Decline(rand.Next(0, 100), item);
            }

            // Выбираем правильное склонение существительного в зависимости от количества.
            string name = number.Case(rand.Next(0, 100), "компьютер", "компьютера", "компьютеров");
        }
Пример #5
0
        static void NumberSamples()
        {
            {
                long value = short.MaxValue;
                Console.WriteLine("Склоняю число прописью в мужском роде для неодушевленных предметов.");
                CyrResult result = cyrNumber.Decline(value);
                WriteToConsole(value.ToString(), result);
            }

            {
                long value = ushort.MaxValue;
                Console.WriteLine("Склоняю число прописью в указанном роде и одушевленности.");
                CyrResult result = cyrNumber.Decline(value, GendersEnum.Feminine, AnimatesEnum.Animated);
                WriteToConsole(value.ToString(), result);
            }

            {
                decimal value = (decimal)ushort.MaxValue / 100;
                Console.WriteLine("Склоняю денежную сумму в рублях.");
                CyrResult result = cyrNumber.Decline(value, new CyrNumber.RurCurrency());
                WriteToConsole(value.ToString(), result);
            }

            {
                decimal value = (decimal)short.MaxValue / 100;
                Console.WriteLine("Склоняю денежную сумму в евро.");
                CyrResult result = cyrNumber.Decline(value, new CyrNumber.EurCurrency());
                WriteToConsole(value.ToString(), result);
            }

            {
                decimal value = short.MaxValue;
                Console.WriteLine("Склоняю количество котов.");
                CyrNoun   cat    = cyrNounCollection.Get("кот", out CasesEnum _, out NumbersEnum _);
                CyrResult result = cyrNumber.Decline(value, new CyrNumber.Item(cat));
                WriteToConsole($"{value.ToString()}, {cat.Name}", result);
            }

            {
                decimal value = (decimal)short.MaxValue / 100;
                Console.WriteLine("Склоняю число прописью в указнный падеж мужского рода для неодушевленных предметов.");
                string result = cyrNumber.ToString(value, CasesEnum.Instrumental);
                WriteToConsole(value.ToString(), CyrDeclineCase.Instrumental, result);
            }

            {
                long value = ushort.MaxValue;
                Console.WriteLine("Склоняет число прописью с указннием падежа, рода и одушевленности.");
                string result = cyrNumber.ToString(value, CasesEnum.Instrumental, GendersEnum.Feminine, AnimatesEnum.Animated);
                WriteToConsole(value.ToString(), CyrDeclineCase.Instrumental, result);
            }

            {
                Console.WriteLine("Выбираю правильный вариант слова в зависимости от указанного числа.");

                for (int i = 0; i < 10; i++)
                {
                    string result = cyrNumber.Case(i, "год", "года", "лет");
                    Console.WriteLine($" - {i} {result}");
                }

                Console.WriteLine();
            }
        }
Пример #6
0
        public CyrNoun Get(string Word, GetConditionsEnum Condition)
        {
            string t = Word;
            string details = this.GetDetails(t);

            if (details.IsNullOrEmpty())
            {
                t = Word.ToLower();
                details = this.GetDetails(t);
            }

            if (details.IsNullOrEmpty())
            {
                t = Word.ToLower().UppercaseFirst();
                details = this.GetDetails(t);
            }

            if (details.IsNullOrEmpty())
            {
                List<int> indexes = new List<int>();
                string lower = Word.ToLower();

                for (int i = 0; i < lower.Length; i++)
                {
                    if (lower[i] == 'е')
                    {
                        indexes.Add(i);
                    }
                }

                foreach (int index in indexes)
                {
                    t = lower.Substring(0, index) + "ё" + lower.Substring(index + 1);
                    details = this.GetDetails(t);

                    if (details.IsNotNullOrEmpty())
                    {
                        break;
                    }
                }
            }

            if (details.IsNullOrEmpty() && Condition == GetConditionsEnum.Similar)
            {
                details = this.GetSimilarDetails(Word, out t);
            }

            if (details.IsNullOrEmpty())
            {
                throw new CyrWordNotFoundException(Word);
            }

            string[] parts = details.Split(',');
            int genderID = int.Parse(parts[0]);
            int animateID = int.Parse(parts[1]);
            int typeID = int.Parse(parts[2]);
            int ruleID = int.Parse(parts[3]);

            parts = this.rules[ruleID].Split(',');

            CyrRule[] rules = parts.Select(val => new CyrRule(val)).ToArray();
            CyrNoun noun = new CyrNoun(Word, t, (GendersEnum)genderID, (AnimatesEnum)animateID, (WordTypesEnum)typeID, rules);

            return noun;
        }
Пример #7
0
        public ActionResult CreateContract(Guid callID)
        {
            var callData    = db.Calls.ToList();
            var itemsData   = db.Items.ToList();
            var custData    = db.Customers.ToList();
            var repData     = db.Representatives.ToList();
            var callDetails = db.CallDetails.ToList();
            //var progdata = db.Programs.ToList();

            var callData2 = (from c in db.CallDetails
                             join item in itemsData on c.ItemID equals item.ItemID
                             join calcdet in db.CalcDetails.ToList() on item.CalcDetailsID equals calcdet.CalcID
                             where (c.CallID == callID)
                             select new ContractViewModel.Itm {
                itemname = item.ItemName, Qty = c.ItemQty.ToString(), itemsubtype = item.ItemSubtype.ItemSubtype1, additionals = item.Additional, calcDate = calcdet.CalcDate.ToString(), calcNum = calcdet.CalcNum
            }).ToList();


            ContractViewModel contract = new ContractViewModel();

            CultureInfo ci = new CultureInfo("RU-ru");

            contract = (from cd in callData
                        join cust in custData on cd.CustomerID equals cust.CustomerID
                        join rep in repData on cust.RepresentativeID equals rep.RepresentativeID
                        join calldet in callDetails on cd.CallID equals calldet.CallID
                        join item in itemsData on calldet.ItemID equals item.ItemID

                        where (cd.CallID == (Guid)callID)
                        select new ContractViewModel {
                CallID = cd.CallID,
                callDate = cd.CallDate.ToString("dd MMMM yyyy г.", ci),
                sampleActDate = cd.SampleActDate.ToString("dd MMMM yyyy г.", ci),
                callNumber = cd.DocNumber.ToString(),
                expAffNum = cd.AffidavitNum.ToString(),
                expAffDate = cd.AffidavitDate.ToString("dd MMMM yyyy г.", ci),
                contractDate = cd.ContractDate,
                repdoc = rep.RepDoc.ToString(),
                repFName = rep.FirstName.ToString(),
                repMName = rep.MidName.ToString(),
                repFamName = rep.FamilyName.ToString(),
                repPosition = rep.Position.ToString(),
                repPhone = rep.PhoneNumber.ToString(),
                custName = cust.Name.ToString(),
                custAddress = cust.Address.ToString(),
                custTaxID = cust.TaxID.ToString(),
                custBIC = cust.BIC.ToString(),
                custPhoneNumber = cust.PhoneNumber.ToString(),
                custOKPO = cust.OKPO.ToString(),
                custAccount = cust.Account.ToString(),
                custBankBranch = cust.BankBranch.ToString(),
                custBranchAddress = cust.BranchAddress.ToString(),
                custBankCode = cust.BankCode.ToString(),
                custMPhoneNumber = cust.MPhoneNumber.ToString()
            }

                        ).FirstOrDefault();

            contract.itmList = callData2;

            ////////////////////////////////////////////////////////////////////////////////////////////////////////

            //                              ВВОД ДАННЫХ В ШАБЛОН ДОГОВОРА                                        //

            ///////////////////////////////////////////////////////////////////////////////////////////////////////


            List <string> expertData = callexp.Split(' ').Reverse().ToList();

            string expName = expertData[0] + expertData[1] + expertData[2];

            int nameIndex = callexp.IndexOf(expName);

            string expertPosition = callexp.Remove(nameIndex, expName.Length);

            string firstWordInPosition = callexp.Split(' ').First();

            int firstWordIndex = expertPosition.IndexOf(firstWordInPosition);

            string expPositionTail = expertPosition.Remove(firstWordIndex, firstWordInPosition.Length);

            CyrNounCollection      nouns = new CyrNounCollection();
            CyrAdjectiveCollection adj   = new CyrAdjectiveCollection();
            CyrPhrase phrase             = new CyrPhrase(nouns, adj);
            CyrResult expname            = phrase.Decline(expName, GetConditionsEnum.Strict);

            expName = expname.Genitive;

            CyrNoun   strict        = nouns.Get(firstWordInPosition, GetConditionsEnum.Strict);
            CyrResult expPosition   = strict.Decline();
            string    firstWordDecl = expPosition.Genitive;

            expertPosition = string.Concat(firstWordDecl, expPositionTail);

            firstWordInPosition = contract.repPosition.Split(' ').First();

            firstWordIndex = contract.repPosition.IndexOf(firstWordInPosition);

            string repPositionTail = contract.repPosition.Remove(firstWordIndex, firstWordInPosition.Length);

            CyrResult repname = phrase.Decline((contract.repFamName + contract.repFName + contract.repMName), GetConditionsEnum.Strict);
            string    repName = repname.Genitive;

            strict = nouns.Get(firstWordInPosition, GetConditionsEnum.Strict);
            CyrResult repPosition = strict.Decline();

            firstWordDecl = repPosition.Genitive;
            string representativePosition = string.Concat(firstWordDecl, expPositionTail);


            try
            {
                Document document = new Document();
                document.LoadFromFile("~/Content/FileTemplates/ContractTemplateCorporate.docx");
                BookmarksNavigator bookmarkNavigator = new BookmarksNavigator(document);
                bookmarkNavigator.MoveToBookmark("ContractNum");
                bookmarkNavigator.ReplaceBookmarkContent(contract.callNumber, true);

                bookmarkNavigator.MoveToBookmark("ContractDay");
                if (contract.contractDate.HasValue)
                {
                    bookmarkNavigator.ReplaceBookmarkContent((contract.contractDate?.ToString("dd", new CultureInfo("ru-RU"))), true);

                    bookmarkNavigator.MoveToBookmark("ContractMonth");
                    bookmarkNavigator.ReplaceBookmarkContent(contract.contractDate?.ToString(" MMMM ", new CultureInfo("ru-RU")), true);

                    bookmarkNavigator.MoveToBookmark("ContractYear");
                    bookmarkNavigator.ReplaceBookmarkContent(contract.contractDate?.ToString(" yyyy г.", new CultureInfo("ru-RU")), true);
                }

                else
                {
                    bookmarkNavigator.ReplaceBookmarkContent((DateTime.Today.ToString("dd", new CultureInfo("ru-RU"))), true);

                    bookmarkNavigator.MoveToBookmark("ContractMonth");
                    bookmarkNavigator.ReplaceBookmarkContent(DateTime.Today.ToString(" MMMM ", new CultureInfo("ru-RU")), true);

                    bookmarkNavigator.MoveToBookmark("ContractYear");
                    bookmarkNavigator.ReplaceBookmarkContent(DateTime.Today.ToString(" yyyy г.", new CultureInfo("ru-RU")), true);
                }

                bookmarkNavigator.MoveToBookmark("ContractExpertPosition");
                bookmarkNavigator.ReplaceBookmarkContent(expertPosition, true);

                bookmarkNavigator.MoveToBookmark("ContractExpertFullName");
                bookmarkNavigator.ReplaceBookmarkContent(expName, true);

                bookmarkNavigator.MoveToBookmark("AffidavitNum");
                bookmarkNavigator.ReplaceBookmarkContent(contract.expAffNum, true);

                bookmarkNavigator.MoveToBookmark("AffidavitDate");
                bookmarkNavigator.ReplaceBookmarkContent(contract.expAffDate, true);

                bookmarkNavigator.MoveToBookmark("CustomerName");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custName, true);

                bookmarkNavigator.MoveToBookmark("CustomerDoc");
                bookmarkNavigator.ReplaceBookmarkContent(" ", true);

                bookmarkNavigator.MoveToBookmark("RepresentativePosition");
                bookmarkNavigator.ReplaceBookmarkContent(representativePosition, true);

                bookmarkNavigator.MoveToBookmark("RepresentativeName");
                bookmarkNavigator.ReplaceBookmarkContent(repName, true);

                bookmarkNavigator.MoveToBookmark("CustomerCompanyDoc");
                bookmarkNavigator.ReplaceBookmarkContent(contract.repdoc, true);

                foreach (ContractViewModel.Itm i in contract.itmList)
                {
                    CyrResult it_name = phrase.Decline(i.itemsubtype, GetConditionsEnum.Strict);
                    i.itemsubtype = it_name.Genitive;

                    bookmarkNavigator.MoveToBookmark("ItemName");
                    bookmarkNavigator.ReplaceBookmarkContent(i.itemsubtype + i.itemname, true);

                    string progname = (from prog in db.Programs.ToList()
                                       join t in db.ItemTypes.ToList() on prog.ItemTypeID equals t.ItemTypeID
                                       join st in db.ItemSubtypes.ToList() on t.ItemTypeID equals st.ItemTypeID
                                       join item in db.Items.ToList() on st.ItemSubtypeID equals item.ItemSubtypeID
                                       where item.ItemName == i.itemname
                                       select prog.ProgramNameShort).FirstOrDefault();


                    bookmarkNavigator.MoveToBookmark("ProgramShortName");
                    bookmarkNavigator.ReplaceBookmarkContent(progname, true);

                    bookmarkNavigator.MoveToBookmark("ItemsNum");
                    bookmarkNavigator.ReplaceBookmarkContent(i.Qty, true);


                    string [] stringarr       = i.additionals.Split(' ');
                    CyrResult addCyr          = phrase.Decline(stringarr[0], GetConditionsEnum.Strict);
                    string    additionals     = addCyr.Genitive;
                    int       index           = i.additionals.IndexOf(additionals);
                    string    additionalsTail = i.additionals.Remove(index, stringarr[0].Length);

                    bookmarkNavigator.MoveToBookmark("Additionals");
                    bookmarkNavigator.ReplaceBookmarkContent(additionals + additionalsTail, true);

                    bookmarkNavigator.MoveToBookmark("CalculationOrderDate");
                    bookmarkNavigator.ReplaceBookmarkContent(i.calcDate, true);

                    bookmarkNavigator.MoveToBookmark("CalculationOrderNum");
                    bookmarkNavigator.ReplaceBookmarkContent(i.calcNum, true);
                }

                decimal TotalSum = 0;
                var     costs    = from callitem in callDetails
                                   where (callitem.CallID == callID)
                                   select callitem.ItemTestCost;
                TotalSum = costs.Sum(c => Convert.ToDecimal(c));

                bookmarkNavigator.MoveToBookmark("TotalSum");
                bookmarkNavigator.ReplaceBookmarkContent(TotalSum.ToString(), true);

                bookmarkNavigator.MoveToBookmark("TestingDurationCalDays");
                bookmarkNavigator.ReplaceBookmarkContent("30", true);

                bookmarkNavigator.MoveToBookmark("ExpertFIO");
                bookmarkNavigator.ReplaceBookmarkContent(expName, true);

                bookmarkNavigator.MoveToBookmark("RepresentativeFIO");
                bookmarkNavigator.ReplaceBookmarkContent(repName, true);

                bookmarkNavigator.MoveToBookmark("CustomerName2");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custName, true);

                bookmarkNavigator.MoveToBookmark("TaxID");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custTaxID, true);

                bookmarkNavigator.MoveToBookmark("OKPO");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custOKPO, true);

                bookmarkNavigator.MoveToBookmark("CustomerAddress");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custAddress, true);

                bookmarkNavigator.MoveToBookmark("CustomerPhoneNum");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custPhoneNumber, true);

                bookmarkNavigator.MoveToBookmark("CustomerMphoneNum");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custMPhoneNumber, true);

                bookmarkNavigator.MoveToBookmark("BankAccount");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custAccount, true);

                bookmarkNavigator.MoveToBookmark("BankBranch");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custBankBranch, true);

                bookmarkNavigator.MoveToBookmark("BankAddress");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custBranchAddress, true);

                bookmarkNavigator.MoveToBookmark("BankCode");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custBankCode, true);

                bookmarkNavigator.MoveToBookmark("BIC");
                bookmarkNavigator.ReplaceBookmarkContent(contract.custBIC, true);

                //Save doc file.

                if (document != null)
                {
                    string path = Server.MapPath(@"~\Area\Manager\Files\Contracts\");
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    document.SaveToFile(path + @"docx\" + contract.CallID.ToString() + ".docx", Spire.Doc.FileFormat.Docx);
                    document.SaveToFile(path + @"pdf\" + contract.CallID.ToString() + ".pdf", Spire.Doc.FileFormat.PDF);
                    ViewBag.pdf = (path + @"pdf\" + contract.CallID.ToString() + ".pdf");
                }
            }

            catch (Exception e)
            {
                return(new HttpNotFoundResult(e.ToString()));
            }



            return(View());
        }
Пример #8
0
        public void Nouns()
        {
            int speechPartNountID            = 1;
            CyrNounCollection nounCollection = new CyrNounCollection();
            CyrillerEntities  mainDB         = new CyrillerEntities();
            int         count = mainDB.Words.Where(x => x.SpeechPartID == speechPartNountID).Count();
            int         step  = 1000;
            List <Task> tasks = new List <Task>();

            mainDB.Dispose();

            for (int i = 0; i < count; i += step)
            {
                int skip = i;

                tasks.Add(Task.Run(() =>
                {
                    CyrillerEntities db     = new CyrillerEntities();
                    IQueryable <Word> words = db.Words.Where(x => x.SpeechPartID == speechPartNountID).OrderBy(x => x.ID).Skip(skip).Take(step);

                    foreach (Word iterator in words)
                    {
                        CyrNoun noun = nounCollection.Get(iterator.Name, (GendersEnum)(iterator.GenderID ?? 0), CasesEnum.Nominative, NumbersEnum.Singular);

                        Assert.NotNull(noun);

                        // There might be multiple the same words in the database, one animated, another one not.
                        int animateID = (int)noun.Animate;
                        int genderID  = (int)noun.Gender;
                        Word word     = db.Words.FirstOrDefault(x =>
                                                                x.Name == noun.Name &&
                                                                x.AnimateID == animateID &&
                                                                (x.GenderID ?? 0) == genderID
                                                                );

                        Assert.NotNull(word);
                        Assert.True((word.GenderID ?? 0) == ((int?)noun.Gender ?? 0), $"{word.ID}|{word.Name} - wrong gender [{noun.Gender}], expected [{word.Gender?.Name}].");
                        Assert.True((word.AnimateID ?? 0) == ((int?)noun.Animate ?? 0), $"{word.ID}|{word.Name} - wrong animate [{noun.Animate}], expected [{word.Animate?.Name}].");
                        Assert.True((word.TypeID ?? 0) == ((int?)noun.WordType ?? 0), $"{word.ID}|{word.Name} - wrong type [{noun.WordType}], expected [{word.WordType?.Name}].");

                        CyrResult result = noun.Decline();

                        Assert.NotNull(result);

                        for (int caseID = 1; caseID < 7; caseID++)
                        {
                            WordCase[] wordCases = word.WordCases.Where(x => x.CaseID == caseID && x.NumberID == 1).ToArray();
                            string errorMessage  = $"{word.ID}|{caseID} - wrong case [{result[caseID]}], expected [{word.Name}].";

                            if (!wordCases.Any())
                            {
                                Assert.True(caseID == 1 || string.IsNullOrEmpty(result[caseID]), errorMessage);
                            }
                            else
                            {
                                Assert.True(wordCases.Any(x => string.Compare(x.Name, result[caseID], true) == 0), errorMessage);
                            }
                        }
                    }

                    db.Dispose();
                }));
            }

            Task.WaitAll(tasks.ToArray());
        }