Exemplo n.º 1
0
        public Enigma(byte[] key, languages lang)
        {
            if (lang == languages.russian)
            {
                alphabet         = alphabetRus;
                alphabetQuantity = alphabetQuantityRus;
                reflector        = reflectorRus;
                highUpperBorder  = 1071;
                lowUpperBorder   = 1040;
            }
            else
            {
                alphabet         = alphabetEng;
                alphabetQuantity = alphabetQuantityEng;
                reflector        = reflectorEng;
                highUpperBorder  = 90;
                lowUpperBorder   = 65;
            }

            rightOffset  = 0;
            middleOffset = 0;
            leftOffset   = 0;
            rightRotor   = new string(GenerateRotor(key, 0, alphabet));
            middleRotor  = new string(GenerateRotor(key, 1, alphabet));
            leftRotor    = new string(GenerateRotor(key, 2, alphabet));
        }
        public ActionResult GetAllMissingTranslations(GridParams g)
        {
            var items              = Ilanguages.GetAll().AsQueryable();
            List <languages> data  = new List <languages>();
            AdminController  admin = new AdminController();

            foreach (var column in items)
            {
                System.Data.DataTable table = admin.getTable();
                for (int i = table.Rows.Count - 1; i >= 0; i--)
                {
                    // whatever your criteria is

                    if (table.Rows[i][column.LanguageName].ToString() != "")
                    {
                        table.Rows[i].Delete();
                    }
                }
                languages a = new languages();
                a.Id                      = Convert.ToInt32(column.Id);
                a.LanguageCode            = column.LanguageCode;
                a.LanguageName            = column.LanguageName;
                a.MissingTranslationCount = table.Rows.Count;
                data.Add(a);
            }

            var key   = Convert.ToInt32(g.Key);
            var model = new GridModelBuilder <languages>(data.AsQueryable(), g)
            {
                Key     = "Id",
                GetItem = () => data.Single(x => x.Id == key)
            }.Build();

            return(Json(model));
        }
        public async Task languages_Create_DoesCreate()
        {
            // Arrange
            string name        = Guid.NewGuid().ToString();
            string description = Guid.NewGuid().ToString();

            languages language = new languages
            {
                Name        = Guid.NewGuid().ToString(),
                Description = Guid.NewGuid().ToString()
            };


            // Act
            await language.Create(dbContext).ConfigureAwait(false);

            languages         dbLanguage        = dbContext.languages.AsNoTracking().First();
            language_versions dbLanguageVersion = dbContext.language_versions.AsNoTracking().First();

            // Assert
            Assert.NotNull(dbLanguage);
            Assert.NotNull(dbLanguageVersion);

            Assert.AreEqual(language.Name, dbLanguage.Name);
            Assert.AreEqual(language.Description, dbLanguage.Description);
        }
Exemplo n.º 4
0
    private void loadSettings()
    {
        settings = new Settings();

        if (PlayerPrefs.HasKey("language"))
        {
            settings.language = PlayerPrefs.GetInt("language");
            //setLanguage((languages)settings.language, false);
            language = (languages)settings.language;

            if (language == languages.eng && !EngToggle.isOn)
            {
                EngToggle.isOn  = true;
                ChTwToggle.isOn = false;
            }
            else if (language == languages.zhTw && !ChTwToggle.isOn)
            {
                ChTwToggle.isOn = true;
                EngToggle.isOn  = false;
            }
            settingsLoaded = true;
        }
        else
        {
            saveSettings();
            settingsLoaded = true;
        }

        if (PlayerPrefs.HasKey("firstRun"))
        {
            firstRun = PlayerPrefs.GetInt("firstRun");
        }
    }
        public async Task languages_Delete_DoesDelete()
        {
            // Arrange
            string name        = Guid.NewGuid().ToString();
            string description = Guid.NewGuid().ToString();

            languages language = new languages
            {
                Name        = name,
                Description = description
            };


            await language.Create(dbContext).ConfigureAwait(false);

            // Act

            await language.Delete(dbContext);

            languages         dbLanguage        = dbContext.languages.AsNoTracking().First();
            language_versions dbLanguageVersion = dbContext.language_versions.AsNoTracking().First();

            // Assert
            Assert.NotNull(dbLanguage);
            Assert.NotNull(dbLanguageVersion);

            Assert.AreEqual(language.WorkflowState, Constants.WorkflowStates.Removed);
        }
Exemplo n.º 6
0
        public ActionResult DeleteConfirmed(int id)
        {
            languages languages = db.languages.Find(id);

            db.languages.Remove(languages);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 7
0
        public async Task Languages_Update_DoesUpdate()
        {
            //Arrange

            languages language = new languages
            {
                Description = Guid.NewGuid().ToString(),
                Name        = Guid.NewGuid().ToString()
            };
            await language.Create(dbContext).ConfigureAwait(false);

            //Act
            DateTime?oldUpdatedAt   = language.UpdatedAt;
            string   oldDescription = language.Description;
            string   oldName        = language.Name;

            language.Description = Guid.NewGuid().ToString();
            language.Name        = Guid.NewGuid().ToString();
            await language.Update(dbContext).ConfigureAwait(false);


            List <languages>         languages        = dbContext.languages.AsNoTracking().ToList();
            List <language_versions> languageVersions = dbContext.language_versions.AsNoTracking().ToList();

            Assert.NotNull(languages);
            Assert.NotNull(languageVersions);

            Assert.AreEqual(1, languages.Count());
            Assert.AreEqual(2, languageVersions.Count());

            Assert.AreEqual(language.CreatedAt.ToString(), languages[0].CreatedAt.ToString());
            Assert.AreEqual(language.Version, languages[0].Version);
//            Assert.AreEqual(language.UpdatedAt.ToString(), languages[0].UpdatedAt.ToString());
            Assert.AreEqual(languages[0].WorkflowState, Constants.WorkflowStates.Created);
            Assert.AreEqual(language.Id, languages[0].Id);
            Assert.AreEqual(language.Description, languages[0].Description);
            Assert.AreEqual(language.Name, languages[0].Name);

            //Old Version
            Assert.AreEqual(language.CreatedAt.ToString(), languageVersions[0].CreatedAt.ToString());
            Assert.AreEqual(1, languageVersions[0].Version);
//            Assert.AreEqual(oldUpdatedAt.ToString(), languageVersions[0].UpdatedAt.ToString());
            Assert.AreEqual(languageVersions[0].WorkflowState, Constants.WorkflowStates.Created);
            Assert.AreEqual(language.Id, languageVersions[0].LanguageId);
            Assert.AreEqual(oldDescription, languageVersions[0].Description);
            Assert.AreEqual(oldName, languageVersions[0].Name);

            //New Version
            Assert.AreEqual(language.CreatedAt.ToString(), languageVersions[1].CreatedAt.ToString());
            Assert.AreEqual(language.Version, languageVersions[1].Version);
//            Assert.AreEqual(language.UpdatedAt.ToString(), languageVersions[1].UpdatedAt.ToString());
            Assert.AreEqual(languageVersions[1].WorkflowState, Constants.WorkflowStates.Created);
            Assert.AreEqual(language.Id, languageVersions[1].LanguageId);
            Assert.AreEqual(language.Description, languageVersions[1].Description);
            Assert.AreEqual(language.Name, languageVersions[1].Name);
        }
Exemplo n.º 8
0
 public ActionResult Edit([Bind(Include = "languages_Id,languages1, freelancer_Id")] languages languages)
 {
     if (ModelState.IsValid)
     {
         db.Entry(languages).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Edit"));
     }
     return(View(languages));
 }
Exemplo n.º 9
0
 public void ChangeLanguage(languages newLanguage)
 {
     PlayerPrefs.SetString("lang", newLanguage.ToString());
     currentLanguage = newLanguage.ToString();
     LMan            = new Lang(languageXML, currentLanguage, false);
     if (languageChanged != null)
     {
         languageChanged();
     }
 }
Exemplo n.º 10
0
        public async Task LanguageQuestionSet_Create_DoesCreate_W_MicrotingUid()
        {
            //Assert
            Random rnd = new Random();

            bool randomBool = rnd.Next(0, 2) > 0;

            question_sets questionSetForQuestion = new question_sets
            {
                Name            = Guid.NewGuid().ToString(),
                Share           = randomBool,
                HasChild        = randomBool,
                ParentId        = rnd.Next(1, 255),
                PosiblyDeployed = randomBool
            };
            await questionSetForQuestion.Create(dbContext).ConfigureAwait(false);

            languages language = new languages
            {
                Description = Guid.NewGuid().ToString(),
                Name        = Guid.NewGuid().ToString()
            };
            await language.Create(dbContext).ConfigureAwait(false);

            language_question_sets languageQuestionSet = new language_question_sets
            {
                LanguageId    = language.Id,
                QuestionSetId = questionSetForQuestion.Id,
                MicrotingUid  = rnd.Next(1, 255)
            };

            //Act
            await languageQuestionSet.Create(dbContext).ConfigureAwait(false);

            List <language_question_sets>         languageQuestionSets        = dbContext.LanguageQuestionSets.AsNoTracking().ToList();
            List <language_question_set_versions> languageQuestionSetVersions =
                dbContext.LanguageQuestionSetVersions.AsNoTracking().ToList();

            //Assert

            Assert.NotNull(languageQuestionSets);
            Assert.NotNull(languageQuestionSetVersions);

            Assert.AreEqual(1, languageQuestionSets.Count);
            Assert.AreEqual(1, languageQuestionSetVersions.Count);

            Assert.AreEqual(languageQuestionSet.LanguageId, languageQuestionSets[0].LanguageId);
            Assert.AreEqual(languageQuestionSet.QuestionSetId, languageQuestionSets[0].QuestionSetId);
            Assert.AreEqual(languageQuestionSet.MicrotingUid, languageQuestionSets[0].MicrotingUid);

            Assert.AreEqual(languageQuestionSet.LanguageId, languageQuestionSetVersions[0].LanguageId);
            Assert.AreEqual(languageQuestionSet.QuestionSetId, languageQuestionSetVersions[0].QuestionSetId);
            Assert.AreEqual(languageQuestionSet.MicrotingUid, languageQuestionSetVersions[0].MicrotingUid);
        }
Exemplo n.º 11
0
        public ActionResult Create([Bind(Include = "languages_Id,languages1,freelancer_Id")] languages languages, int?id)
        {
            if (ModelState.IsValid)
            {
                languages.freelancer_id = id;
                db.languages.Add(languages);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            return(View(languages));
        }
Exemplo n.º 12
0
        // GET: languages/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            languages languages = db.languages.Find(id);

            if (languages == null)
            {
                return(HttpNotFound());
            }
            return(View(languages));
        }
Exemplo n.º 13
0
    public void setLanguage(languages lang, bool saveSets = true)
    {
        if (!settingsLoaded)
        {
            return;
        }

        language = lang;
        if (OnLanguageChanged != null)
        {
            OnLanguageChanged();
        }
        if (saveSets)
        {
            saveSettings();
        }
    }
Exemplo n.º 14
0
        public static async Task Main()
        {
            _core = new Core();

            var connection = _core
                             .StartSqlOnly(
                "host= localhost;Database=420_SDK;user = root;port=3306;Convert Zero Datetime = true;SslMode=none;")
                             .Result;

            MicrotingDbContext dbContext = _core.dbContextHelper.GetDbContext();

            question_sets questionSets = new question_sets
            {
                Name = "Test-Set"
            };

            if (dbContext.question_sets.Count(x => x.Name == questionSets.Name) != 1)
            {
                await questionSets.Create(dbContext);
            }

            languages language = new languages
            {
                Description = "Description",
                Name        = "Danish"
            };

            if (dbContext.languages.Count(x => x.Name == "da-DK") != 1)
            {
                await language.Create(dbContext);
            }

            languages dbLanguage = await dbContext.languages.FirstOrDefaultAsync(x => x.Name == language.Name);

            question_sets dbQuestionSets = await dbContext.question_sets.FirstOrDefaultAsync(x => x.Name == questionSets.Name);

            string[] questionNames = new[] { "Q1", "Q2", "Q3", "Q4", "Q5", "Q6", "Q7", "Q8", "Q9", "Q10", "Q11", "Q12", "Q13" };
            //                                13    14    15    16    17    18    19    20    21    22    23    24
            List <KeyValuePair <int, questions> > questionIds = new List <KeyValuePair <int, questions> >();

            int qi = 13;

            foreach (var questionName in questionNames)
            {
                if (questionName != "Q13" && questionName != "Q1")
                {
                    var questionTranslation =
                        dbContext.QuestionTranslations.SingleOrDefault(x => x.Name == questionName);

                    if (questionTranslation == null)
                    {
                        questions question = new questions()
                        {
                            QuestionSetId = dbQuestionSets.Id,
                            QuestionType  = Constants.QuestionTypes.Smiley2
                        };
                        await question.Create(dbContext);

                        KeyValuePair <int, questions> kvp = new KeyValuePair <int, questions>(qi, question);
                        questionIds.Add(kvp);

                        questionTranslation = new question_translations()
                        {
                            Name       = questionName,
                            QuestionId = question.Id,
                            LanguageId = dbLanguage.Id
                        };
                        await questionTranslation.Create(dbContext);
                    }
                    else
                    {
                        KeyValuePair <int, questions> kvp = new KeyValuePair <int, questions>(qi, questionTranslation.Question);
                        questionIds.Add(kvp);
                    }
                }
                else
                {
                    var questionTranslation =
                        dbContext.QuestionTranslations.SingleOrDefault(x => x.Name == questionName);

                    if (questionTranslation == null)
                    {
                        questions question = new questions()
                        {
                            QuestionSetId = dbQuestionSets.Id,
                            QuestionType  = questionName == "Q1" ? Constants.QuestionTypes.List : Constants.QuestionTypes.Multi
                        };
                        await question.Create(dbContext);

                        questionTranslation = new question_translations()
                        {
                            Name       = questionName,
                            QuestionId = question.Id,
                            LanguageId = dbLanguage.Id
                        };
                        await questionTranslation.Create(dbContext);

                        string[] questionOptions;
                        if (questionName == "Q1")
                        {
                            questionOptions = new[] { "Ja", "Nej" };
                        }
                        else
                        {
                            questionOptions = new[] { "1", "2", "3", "4", "5" };
                        }


                        foreach (string questionOption in questionOptions)
                        {
                            options option = new options()
                            {
                                QuestionId  = question.Id,
                                Weight      = 1,
                                WeightValue = 1
                            };
                            await option.Create(dbContext);

                            option_translations optionTranslation = new option_translations()
                            {
                                OptionId   = option.Id,
                                Name       = questionOption,
                                LanguageId = dbLanguage.Id
                            };

                            await optionTranslation.Create(dbContext);
                        }

                        KeyValuePair <int, questions> kvp = new KeyValuePair <int, questions>(qi, question);
                        questionIds.Add(kvp);
                    }
                    else
                    {
                        KeyValuePair <int, questions> kvp = new KeyValuePair <int, questions>(qi, questionTranslation.Question);
                        questionIds.Add(kvp);
                    }
                }
                qi++;
            }

            // Q13 with options

            // KeyValuePair<int, questions> kvp = new KeyValuePair<int, questions>(qi, questionTranslation.Question);
            // questionIds.Add(kvp);

            survey_configurations surveyConfiguration = new survey_configurations
            {
                QuestionSetId = dbQuestionSets.Id,
                Name          = "Configuartion 1"
            };

            if (dbContext.survey_configurations.Count(x => x.Name == surveyConfiguration.Name) != 1)
            {
                await surveyConfiguration.Create(dbContext);
            }

            survey_configurations dbSurveyConfiguration =
                await dbContext.survey_configurations.FirstOrDefaultAsync(x => x.Name == surveyConfiguration.Name);

            // dbContext.question_sets questionSets = new question_sets();
            Random rnd      = new Random();
            var    document = @"/home/microting/Documents/workspace/microting/ExcelReadManipPOC/Test-data.xlsx";

            using (FileStream fs = new FileStream(document, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                using (SpreadsheetDocument doc = SpreadsheetDocument.Open(fs, false))
                {
                    S sheets = doc.WorkbookPart.Workbook.Sheets;

                    foreach (E sheet in sheets)
                    {
                        foreach (A attr in sheet.GetAttributes())
                        {
                            Console.WriteLine("{0}: {1}", attr.LocalName, attr.Value);
                        }
                    }

                    WorkbookPart  workbookPart  = doc.WorkbookPart;
                    WorksheetPart worksheetPart = GetWorksheetFromSheetName(workbookPart, "Senge_voksen");

                    var sheet1 = worksheetPart.Worksheet;


                    // Console.WriteLine(sheet1);


                    var cells = sheet1.Descendants <Cell>();
                    var rows  = sheet1.Descendants <Row>();
                    var cols  = sheet1.Descendants <Column>();

                    List <Column> columns = cols.ToList();

                    string text;
                    var    rows1       = sheet1.GetFirstChild <SheetData>().Elements <Row>();
                    int    i           = 0;
                    var    stringTable = workbookPart.GetPartsOfType <SharedStringTablePart>()
                                         .FirstOrDefault();
                    List <KeyValuePair <string, sites> > localSites = new List <KeyValuePair <string, sites> >();
                    List <KeyValuePair <string, units> > localUnits = new List <KeyValuePair <string, units> >();
                    var languageId = dbContext.languages.SingleOrDefault(x => x.Name == "da-DK");
                    // List<sites> localSites = new List<sites>();
                    // List<units> localUnits = new List<units>();
                    foreach (var row in rows1)
                    {
                        if (i > 0 && i < 553)
                        {
                            var cells1 = row.Elements <Cell>();

                            int         cellNumber   = 0;
                            answers     answer       = null;
                            List <Cell> theCells     = cells1.ToList();
                            var         microtingUid = int.Parse(theCells[0].CellValue.Text);
                            var         duration     = int.Parse(theCells[1].CellValue.Text);
                            var         date         = stringTable.SharedStringTable.ElementAt(
                                int.Parse(theCells[2].CellValue.Text)).InnerText;
                            var time = stringTable.SharedStringTable.ElementAt(
                                int.Parse(theCells[7].CellValue.Text)).InnerText;

                            DateTime dateOfDoing = DateTime.ParseExact($"{date} {time}", "dd-MM-yyyy HH:mm:ss", null);

                            var location = stringTable.SharedStringTable.ElementAt(
                                int.Parse(theCells[9].CellValue.Text)).InnerText;

                            int?sdkSiteId = null;
                            int?sdkUnitId = null;

                            if (localSites.Any(x => x.Key == location))
                            {
                                sdkSiteId = localSites.First(x => x.Key == location).Value.Id;
                            }
                            else
                            {
                                var lookupSite = dbContext.sites.SingleOrDefault(x => x.Name == location);
                                if (lookupSite != null)
                                {
                                    KeyValuePair <string, sites> pair = new KeyValuePair <string, sites>(location, lookupSite);
                                    localSites.Add(pair);
                                    sdkSiteId = lookupSite.Id;
                                }
                                else
                                {
                                    sites site = new sites()
                                    {
                                        Name         = location,
                                        MicrotingUid = rnd.Next(1, 999999)
                                    };
                                    await site.Create(dbContext);

                                    KeyValuePair <string, sites> pair = new KeyValuePair <string, sites>(location, site);
                                    localSites.Add(pair);
                                    sdkSiteId = site.Id;
                                }
                            }

                            var unitString = theCells[11].CellValue.Text;
                            if (localUnits.Any(x => x.Key == unitString))
                            {
                                sdkUnitId = localUnits.First(x => x.Key == unitString).Value.Id;
                            }
                            else
                            {
                                var lookupUnit = dbContext.units.SingleOrDefault(x => x.MicrotingUid.ToString() == unitString);

                                if (lookupUnit != null)
                                {
                                    KeyValuePair <string, units> pair = new KeyValuePair <string, units>(unitString, lookupUnit);
                                    localUnits.Add(pair);
                                    sdkUnitId = lookupUnit.Id;
                                }
                                else
                                {
                                    units unit = new units()
                                    {
                                        MicrotingUid = int.Parse(unitString),
                                        SiteId       = sdkSiteId
                                    };
                                    await unit.Create(dbContext);

                                    KeyValuePair <string, units> pair = new KeyValuePair <string, units>(unitString, unit);
                                    localUnits.Add(pair);
                                    sdkUnitId = unit.Id;
                                }
                            }



                            answer = dbContext.answers.SingleOrDefault(x =>
                                                                       x.MicrotingUid == microtingUid);
                            if (answer == null)
                            {
                                answer = new answers()
                                {
                                    AnswerDuration        = duration,
                                    UnitId                = (int)sdkUnitId,
                                    SiteId                = (int)sdkSiteId,
                                    MicrotingUid          = microtingUid,
                                    FinishedAt            = dateOfDoing,
                                    LanguageId            = dbLanguage.Id,
                                    QuestionSetId         = dbQuestionSets.Id,
                                    SurveyConfigurationId = dbSurveyConfiguration.Id
                                };
                                await answer.Create(dbContext);
                            }

                            foreach (var cell in cells1)
                            {
                                if (cell == null)
                                {
                                    Console.WriteLine("We got a null here");
                                }
                                else
                                {
                                    if (cellNumber > 12)
                                    {
                                        int questionLookupId = cellNumber;
                                        if (cellNumber > 25)
                                        {
                                            questionLookupId = 25;
                                        }

                                        int?lookupOptionId = null;
                                        if (cell.DataType != null)
                                        {
                                            //     if (cell.DataType.Value == CellValues.Number)
                                            //     {
                                            //         lookupOptionId = questionIds
                                            //             .First(x => x.Key == questionLookupId).Value.Options
                                            //             .SingleOrDefault(x => x.WeightValue == int.Parse(cell.CellValue.Text)).Id;
                                            if (cell.DataType.Value == CellValues.SharedString)
                                            {
                                                //         if (questionLookupId != 25)
                                                //         {
                                                foreach (options option in questionIds
                                                         .First(x => x.Key == questionLookupId).Value.Options)
                                                {
                                                    text = stringTable.SharedStringTable.ElementAt(
                                                        int.Parse(cell.CellValue.Text)).InnerText;

                                                    var r = option.OptionTranslationses.SingleOrDefault(x =>
                                                                                                        x.Name == text);
                                                    if (r != null)
                                                    {
                                                        lookupOptionId = r.OptionId;
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (cellNumber > 13 && cellNumber < 25)
                                            {
                                                if (cell.CellValue != null)
                                                {
                                                    lookupOptionId = questionIds
                                                                     .First(x => x.Key == questionLookupId).Value.Options
                                                                     .SingleOrDefault(x => x.WeightValue == int.Parse(cell.CellValue.Text)).Id;
                                                }
                                            }
                                            else
                                            {
                                                switch (cellNumber)
                                                {
                                                case 25:
                                                    lookupOptionId = questionIds
                                                                     .First(x => x.Key == questionLookupId).Value.Options
                                                                     .ToList()[0].Id;
                                                    break;

                                                case 26:
                                                    lookupOptionId = questionIds
                                                                     .First(x => x.Key == questionLookupId).Value.Options
                                                                     .ToList()[1].Id;
                                                    break;

                                                case 27:
                                                    lookupOptionId = questionIds
                                                                     .First(x => x.Key == questionLookupId).Value.Options
                                                                     .ToList()[2].Id;
                                                    break;

                                                case 28:
                                                    lookupOptionId = questionIds
                                                                     .First(x => x.Key == questionLookupId).Value.Options
                                                                     .ToList()[3].Id;
                                                    break;

                                                case 29:
                                                    lookupOptionId = questionIds
                                                                     .First(x => x.Key == questionLookupId).Value.Options
                                                                     .ToList()[4].Id;
                                                    break;
                                                }
                                            }
                                        }

                                        //         }
                                        //         else
                                        //         {
                                        //             if (questionLookupId == 25)
                                        //             {
                                        //                 lookupOptionId = questionIds.First(x => x.Key == questionLookupId)
                                        //                     .Value.Options.ToList()[cellNumber - 25].Id;
                                        //             }
                                        //         }
                                        //     }
                                        // }
                                        // else
                                        // {
                                        //     lookupOptionId = questionIds
                                        //         .First(x => x.Key == questionLookupId).Value.Options
                                        //         .SingleOrDefault(x => x.WeightValue == int.Parse(cell.CellValue.Text)).Id;
                                        // }
                                        //
                                        answer_values answerValue = null;
                                        if (lookupOptionId != null)
                                        {
                                            answerValue = dbContext.answer_values
                                                          .SingleOrDefault(x
                                                                           => x.AnswerId == answer.Id &&
                                                                           x.QuestionId == questionIds.First(y
                                                                                                             => y.Key == questionLookupId).Value.Id &&
                                                                           x.OptionId == lookupOptionId);
                                        }
                                        else
                                        {
                                            answerValue = dbContext.answer_values
                                                          .SingleOrDefault(x
                                                                           => x.AnswerId == answer.Id &&
                                                                           x.QuestionId == questionIds.First(y
                                                                                                             => y.Key == questionLookupId).Value.Id);
                                        }

                                        if (answerValue == null)
                                        {
                                            answerValue = new answer_values()
                                            {
                                                AnswerId   = answer.Id,
                                                QuestionId = questionIds.First(x => x.Key == questionLookupId).Value.Id
                                            };

                                            if (cell.DataType != null)
                                            {
                                                if (cell.DataType.Value == CellValues.SharedString)
                                                {
                                                    if (stringTable != null)
                                                    {
                                                        text = stringTable.SharedStringTable.ElementAt(
                                                            int.Parse(cell.CellValue.Text)).InnerText;
                                                        // Console.WriteLine(text + " ");
                                                        int optionId = 0;
                                                        foreach (options option in questionIds
                                                                 .First(x => x.Key == questionLookupId).Value.Options)
                                                        {
                                                            var r = option.OptionTranslationses.SingleOrDefault(x => x.Name == text);
                                                            if (r != null)
                                                            {
                                                                optionId = r.OptionId;
                                                            }
                                                        }
                                                        answerValue.Value      = text;
                                                        answerValue.OptionId   = optionId;
                                                        answerValue.QuestionId = questionIds
                                                                                 .First(x => x.Key == questionLookupId).Value.Id;
                                                        await answerValue.Create(dbContext);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (cellNumber > 13 && cellNumber < 25)
                                                {
                                                    if (cell.CellValue != null)
                                                    {
                                                        text = cell.CellValue.Text;

                                                        answerValue.Value      = text;
                                                        answerValue.QuestionId = questionIds
                                                                                 .First(x => x.Key == questionLookupId).Value.Id;
                                                        answerValue.OptionId = questionIds
                                                                               .First(x => x.Key == questionLookupId).Value.Options
                                                                               .SingleOrDefault(x => x.WeightValue == int.Parse(text)).Id;
                                                        await answerValue.Create(dbContext);

                                                        // Console.WriteLine(cell.CellValue.Text);
                                                    }
                                                }
                                                else
                                                {
                                                    if (cell.CellValue != null)
                                                    {
                                                        if (int.Parse(cell.CellValue.Text) == 1)
                                                        {
                                                            answerValue.Value      = "1";
                                                            answerValue.QuestionId = questionIds
                                                                                     .First(x => x.Key == questionLookupId).Value.Id;
                                                            switch (cellNumber)
                                                            {
                                                            case 25:
                                                                answerValue.OptionId = questionIds
                                                                                       .First(x => x.Key == questionLookupId).Value.Options.ToList()[0].Id;
                                                                break;

                                                            case 26:
                                                                answerValue.OptionId = questionIds
                                                                                       .First(x => x.Key == questionLookupId).Value.Options.ToList()[1].Id;
                                                                break;

                                                            case 27:
                                                                answerValue.OptionId = questionIds
                                                                                       .First(x => x.Key == questionLookupId).Value.Options.ToList()[2].Id;
                                                                break;

                                                            case 28:
                                                                answerValue.OptionId = questionIds
                                                                                       .First(x => x.Key == questionLookupId).Value.Options.ToList()[3].Id;
                                                                break;

                                                            case 29:
                                                                answerValue.OptionId = questionIds
                                                                                       .First(x => x.Key == questionLookupId).Value.Options.ToList()[4].Id;
                                                                break;
                                                            }

                                                            await answerValue.Create(dbContext);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                cellNumber++;
                            }
                        }
                        Console.WriteLine($"ROW {i}");
                        i++;
                    }
                }
            }
            // Q1
            int q1Id           = 1;
            int q2Id           = 2;
            int q3Id           = 3;
            int q4Id           = 4;
            int q5Id           = 5;
            int q6Id           = 6;
            int q7Id           = 7;
            int q8Id           = 8;
            int q9Id           = 9;
            int q10Id          = 10;
            int q11Id          = 11;
            int q12Id          = 12;
            int q13Id          = 13;
            int optionJaId     = 1;
            int optionNejId    = 2;
            int option100q2Id  = 3;
            int option75q2Id   = 4;
            int option50q2Id   = 5;
            int option25q2Id   = 6;
            int option0q2Id    = 7;
            int option999q2Id  = 8;
            int option100q3Id  = 9;
            int option75q3Id   = 10;
            int option50q3Id   = 11;
            int option25q3Id   = 12;
            int option0q3Id    = 13;
            int option999q3Id  = 14;
            int option100q4Id  = 15;
            int option75q4Id   = 16;
            int option50q4Id   = 17;
            int option25q4Id   = 18;
            int option0q4Id    = 19;
            int option999q4Id  = 20;
            int option100q5Id  = 21;
            int option75q5Id   = 22;
            int option50q5Id   = 23;
            int option25q5Id   = 24;
            int option0q5Id    = 25;
            int option999q5Id  = 26;
            int option100q6Id  = 27;
            int option75q6Id   = 28;
            int option50q6Id   = 29;
            int option25q6Id   = 30;
            int option0q6Id    = 31;
            int option999q6Id  = 32;
            int option100q7Id  = 33;
            int option75q7Id   = 34;
            int option50q7Id   = 35;
            int option25q7Id   = 36;
            int option0q7Id    = 37;
            int option999q7Id  = 38;
            int option100q8Id  = 39;
            int option75q8Id   = 40;
            int option50q8Id   = 41;
            int option25q8Id   = 42;
            int option0q8Id    = 43;
            int option999q8Id  = 44;
            int option100q9Id  = 45;
            int option75q9Id   = 46;
            int option50q9Id   = 47;
            int option25q9Id   = 48;
            int option0q9Id    = 49;
            int option999q9Id  = 50;
            int option100q10Id = 51;
            int option75q10Id  = 52;
            int option50q10Id  = 53;
            int option25q10Id  = 54;
            int option0q10Id   = 55;
            int option999q10Id = 56;
            int option100q11Id = 57;
            int option75q11Id  = 58;
            int option50q11Id  = 59;
            int option25q11Id  = 60;
            int option0q11Id   = 61;
            int option999q11Id = 62;
            int option100q12Id = 63;
            int option75q12Id  = 64;
            int option50q12Id  = 65;
            int option25q12Id  = 66;
            int option0q12Id   = 67;
            int option999q12Id = 68;
            int optionq13_1Id  = 69;
            int optionq13_2Id  = 70;
            int optionq13_3Id  = 71;
            int optionq13_4Id  = 72;
            int optionq13_5Id  = 73;

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == optionJaId) == 419);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == optionNejId) == 133);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q1Id) == 552);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q2Id) == 5);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q2Id) == 7);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q2Id) == 14);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q2Id) == 112);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q2Id) == 275);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q2Id) == 6);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q2Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q3Id) == 15);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q3Id) == 8);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q3Id) == 44);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q3Id) == 144);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q3Id) == 201);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q3Id) == 7);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q3Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q4Id) == 13);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q4Id) == 17);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q4Id) == 78);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q4Id) == 123);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q4Id) == 176);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q4Id) == 12);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q4Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q5Id) == 16);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q5Id) == 18);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q5Id) == 49);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q5Id) == 135);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q5Id) == 188);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q5Id) == 13);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q5Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q6Id) == 21);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q6Id) == 23);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q6Id) == 61);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q6Id) == 131);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q6Id) == 160);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q6Id) == 23);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q6Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q7Id) == 13);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q7Id) == 8);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q7Id) == 57);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q7Id) == 116);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q7Id) == 216);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q7Id) == 9);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q7Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q8Id) == 35);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q8Id) == 27);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q8Id) == 98);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q8Id) == 108);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q8Id) == 124);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q8Id) == 27);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q8Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q9Id) == 19);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q9Id) == 23);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q9Id) == 51);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q9Id) == 107);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q9Id) == 213);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q9Id) == 6);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q9Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q10Id) == 16);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q10Id) == 10);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q10Id) == 66);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q10Id) == 116);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q10Id) == 186);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q10Id) == 25);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q10Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q11Id) == 11);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q11Id) == 8);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q11Id) == 41);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q11Id) == 111);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q11Id) == 211);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q11Id) == 37);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q11Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option0q12Id) == 12);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option25q12Id) == 9);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option50q12Id) == 58);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option75q12Id) == 126);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option100q12Id) == 187);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == option999q12Id) == 27);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q12Id) == 419);

            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == optionq13_1Id) == 289);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q13Id) == 1383);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == optionq13_2Id) == 273);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q13Id) == 1383);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == optionq13_3Id) == 281);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q13Id) == 1383);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == optionq13_4Id) == 271);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q13Id) == 1383);
            Debug.Assert(dbContext.answer_values.Count(x => x.OptionId == optionq13_5Id) == 269);
            Debug.Assert(dbContext.answer_values.Count(x => x.QuestionId == q13Id) == 1383);
            Console.WriteLine("we are done");
        }
        public async Task SQL_answers_Create_DoesCreate_UTCAdjustedTrue()
        {
            // Arrange
            Random rnd   = new Random();
            sites  site1 = await testHelpers.CreateSite(Guid.NewGuid().ToString(), rnd.Next(1, 255));

            units unit1 = await testHelpers.CreateUnit(rnd.Next(1, 255), rnd.Next(1, 255), site1, rnd.Next(1, 255));

            languages language = new languages
            {
                Name = Guid.NewGuid().ToString(), Description = Guid.NewGuid().ToString()
            };
            await language.Create(dbContext).ConfigureAwait(false);



            string        name        = Guid.NewGuid().ToString();
            question_sets questionSet = new question_sets
            {
                Name = name, Share = false, HasChild = false, PosiblyDeployed = false
            };
            await questionSet.Create(dbContext).ConfigureAwait(false);

            survey_configurations surveyConfiguration = new survey_configurations
            {
                Name          = Guid.NewGuid().ToString(),
                Stop          = DateTime.Now,
                Start         = DateTime.Now,
                TimeOut       = rnd.Next(1, 255),
                TimeToLive    = rnd.Next(1, 255),
                QuestionSetId = questionSet.Id
            };
            await surveyConfiguration.Create(dbContext).ConfigureAwait(false);

            answers answer = new answers
            {
                SiteId                = site1.Id,
                QuestionSetId         = questionSet.Id,
                SurveyConfigurationId = surveyConfiguration.Id,
                UnitId                = unit1.Id,
                TimeZone              = Guid.NewGuid().ToString(),
                FinishedAt            = DateTime.Now,
                LanguageId            = language.Id,
                AnswerDuration        = rnd.Next(1, 255),
                UtcAdjusted           = true
            };
            // Act
            await answer.Create(dbContext).ConfigureAwait(false);

            answers         dbAnswer  = dbContext.answers.AsNoTracking().First();
            answer_versions dbVersion = dbContext.answer_versions.AsNoTracking().First();

            // Assert
            Assert.NotNull(dbAnswer);
            Assert.NotNull(dbVersion);

            Assert.AreEqual(dbAnswer.SiteId, answer.SiteId);
            Assert.AreEqual(dbAnswer.QuestionSetId, answer.QuestionSetId);
            Assert.AreEqual(dbAnswer.SurveyConfigurationId, answer.SurveyConfigurationId);
            Assert.AreEqual(dbAnswer.UnitId, answer.UnitId);
            Assert.AreEqual(dbAnswer.TimeZone, answer.TimeZone);
            Assert.AreEqual(dbAnswer.FinishedAt.ToString(), answer.FinishedAt.ToString());
            Assert.AreEqual(dbAnswer.LanguageId, answer.LanguageId);
            Assert.AreEqual(dbAnswer.AnswerDuration, answer.AnswerDuration);
            Assert.AreEqual(dbAnswer.UtcAdjusted, answer.UtcAdjusted);
        }
Exemplo n.º 16
0
        public async Task AnswerValues_Delete_DoesSetWorkflowStateToRemoved()
        {
            //Arrange

            Random rnd = new Random();

            bool randomBool = rnd.Next(0, 2) > 0;

            sites site = new sites
            {
                Name         = Guid.NewGuid().ToString(),
                MicrotingUid = rnd.Next(1, 255)
            };
            await site.Create(dbContext).ConfigureAwait(false);

            sites siteForUnit = new sites
            {
                Name         = Guid.NewGuid().ToString(),
                MicrotingUid = rnd.Next(1, 255)
            };
            await siteForUnit.Create(dbContext).ConfigureAwait(false);

            units unit = new units
            {
                CustomerNo   = rnd.Next(1, 255),
                MicrotingUid = rnd.Next(1, 255),
                OtpCode      = rnd.Next(1, 255),
                SiteId       = siteForUnit.Id
            };
            await unit.Create(dbContext).ConfigureAwait(false);

            languages language = new languages
            {
                Description = Guid.NewGuid().ToString(),
                Name        = Guid.NewGuid().ToString()
            };
            await language.Create(dbContext).ConfigureAwait(false);

            question_sets questionSet = new question_sets
            {
                Name            = Guid.NewGuid().ToString(),
                Share           = randomBool,
                HasChild        = randomBool,
                PosiblyDeployed = randomBool
            };
            await questionSet.Create(dbContext).ConfigureAwait(false);

            survey_configurations surveyConfiguration = new survey_configurations
            {
                Name          = Guid.NewGuid().ToString(),
                Start         = DateTime.Now,
                Stop          = DateTime.Now,
                TimeOut       = rnd.Next(1, 255),
                TimeToLive    = rnd.Next(1, 255),
                QuestionSetId = questionSet.Id
            };
            await surveyConfiguration.Create(dbContext).ConfigureAwait(false);

            answers answer = new answers
            {
                AnswerDuration        = rnd.Next(1, 255),
                FinishedAt            = DateTime.Now,
                LanguageId            = language.Id,
                SiteId                = site.Id,
                SurveyConfiguration   = surveyConfiguration,
                TimeZone              = Guid.NewGuid().ToString(),
                UnitId                = unit.Id,
                UtcAdjusted           = randomBool,
                QuestionSetId         = questionSet.Id,
                SurveyConfigurationId = surveyConfiguration.Id
            };
            await answer.Create(dbContext).ConfigureAwait(false);

            questions question = new questions
            {
                Image                = randomBool,
                Maximum              = rnd.Next(1, 255),
                Minimum              = rnd.Next(1, 255),
                Prioritised          = randomBool,
                Type                 = Guid.NewGuid().ToString(),
                FontSize             = Guid.NewGuid().ToString(),
                ImagePosition        = Guid.NewGuid().ToString(),
                MaxDuration          = rnd.Next(1, 255),
                MinDuration          = rnd.Next(1, 255),
                QuestionIndex        = rnd.Next(1, 255),
                QuestionType         = Guid.NewGuid().ToString(),
                RefId                = rnd.Next(1, 255),
                ValidDisplay         = randomBool,
                BackButtonEnabled    = randomBool,
                ContinuousQuestionId = rnd.Next(1, 255),
                QuestionSetId        = questionSet.Id
            };
            await question.Create(dbContext).ConfigureAwait(false);

            options option = new options
            {
                Weight             = rnd.Next(1, 255),
                OptionsIndex       = rnd.Next(1, 255),
                QuestionId         = question.Id,
                WeightValue        = rnd.Next(1, 255),
                ContinuousOptionId = rnd.Next(1, 255)
            };
            await option.Create(dbContext).ConfigureAwait(false);

            questions questionForAnswerValue = new questions
            {
                Image                = randomBool,
                Maximum              = rnd.Next(1, 255),
                Minimum              = rnd.Next(1, 255),
                Prioritised          = randomBool,
                Type                 = Guid.NewGuid().ToString(),
                FontSize             = Guid.NewGuid().ToString(),
                ImagePosition        = Guid.NewGuid().ToString(),
                MaxDuration          = rnd.Next(1, 255),
                MinDuration          = rnd.Next(1, 255),
                QuestionIndex        = rnd.Next(1, 255),
                QuestionType         = Guid.NewGuid().ToString(),
                RefId                = rnd.Next(1, 255),
                ValidDisplay         = randomBool,
                BackButtonEnabled    = randomBool,
                ContinuousQuestionId = rnd.Next(1, 255),
                QuestionSetId        = questionSet.Id
            };
            await questionForAnswerValue.Create(dbContext).ConfigureAwait(false);

            answer_values answerValue = new answer_values
            {
                Value      = rnd.Next(1, 255).ToString(),
                AnswerId   = answer.Id,
                OptionId   = option.Id,
                QuestionId = question.Id
            };
            await answerValue.Create(dbContext).ConfigureAwait(false);

            //Act

            DateTime?oldUpdatedAt = answerValue.UpdatedAt;

            await answerValue.Delete(dbContext);


            List <answer_values>         answerValues        = dbContext.answer_values.AsNoTracking().ToList();
            List <answer_value_versions> answerValueVersions = dbContext.answer_value_versions.AsNoTracking().ToList();

            //Assert

            Assert.NotNull(answerValues);
            Assert.NotNull(answerValueVersions);

            Assert.AreEqual(1, answerValues.Count());
            Assert.AreEqual(2, answerValueVersions.Count());

            Assert.AreEqual(answerValue.CreatedAt.ToString(), answerValues[0].CreatedAt.ToString());
            Assert.AreEqual(answerValue.Version, answerValues[0].Version);
//             Assert.AreEqual(answerValue.UpdatedAt.ToString(), answerValues[0].UpdatedAt.ToString());
            Assert.AreEqual(answerValues[0].WorkflowState, Constants.WorkflowStates.Removed);
            Assert.AreEqual(answerValue.Value, answerValues[0].Value);
            Assert.AreEqual(answerValue.Id, answerValues[0].Id);
            Assert.AreEqual(answerValue.AnswerId, answer.Id);
            Assert.AreEqual(answerValue.OptionId, option.Id);
            Assert.AreEqual(answerValue.QuestionId, question.Id);

            //Old Version
            Assert.AreEqual(answerValue.CreatedAt.ToString(), answerValueVersions[0].CreatedAt.ToString());
            Assert.AreEqual(1, answerValueVersions[0].Version);
//             Assert.AreEqual(oldUpdatedAt.ToString(), answerValueVersions[0].UpdatedAt.ToString());
            Assert.AreEqual(answerValueVersions[0].WorkflowState, Constants.WorkflowStates.Created);
            Assert.AreEqual(answerValue.Id, answerValueVersions[0].AnswerValueId);
            Assert.AreEqual(answerValue.Value, answerValueVersions[0].Value);
            Assert.AreEqual(answer.Id, answerValueVersions[0].AnswerId);
            Assert.AreEqual(option.Id, answerValueVersions[0].OptionId);
            Assert.AreEqual(question.Id, answerValueVersions[0].QuestionId);

            //New Version
            Assert.AreEqual(answerValue.CreatedAt.ToString(), answerValueVersions[1].CreatedAt.ToString());
            Assert.AreEqual(2, answerValueVersions[1].Version);
//             Assert.AreEqual(answerValue.UpdatedAt.ToString(), answerValueVersions[1].UpdatedAt.ToString());
            Assert.AreEqual(answerValueVersions[1].WorkflowState, Constants.WorkflowStates.Removed);
            Assert.AreEqual(answerValue.Id, answerValueVersions[1].AnswerValueId);
            Assert.AreEqual(answerValue.Value, answerValueVersions[1].Value);
            Assert.AreEqual(answer.Id, answerValueVersions[1].AnswerId);
            Assert.AreEqual(option.Id, answerValueVersions[1].OptionId);
            Assert.AreEqual(question.Id, answerValueVersions[1].QuestionId);
        }
 public ActionResult IndexNew(languages lang)
 {
     return(View("ConfirmNew", lang));
 }
Exemplo n.º 18
0
	public void SetUkrainian()
	{
		CurrentLanguage = languages.ukrainian;

		lw_enter_login.text = "Введіть логін";
		lw_enter_password.text = "Введіть пароль";
		lw_confirm_password.text = "Повторіть пароль";
		lw_Login_btn.text = "Увійти";
		lw_Enter_tab.text = "Вхід";
		lw_Reg_tab.text = "Реєстрація";
//		lw_DoReg_btn.text = "Зареєструватись";
//		lw_NoReg_btn.text = "Вхід без реєстрації";
//		lw_Back_btn.text = "Реєстрація";
		lw_error_header = "Помилка";
		lw_incorrect = "Логін/Пароль невірний";
		lw_connection = "Немає з'єднання із сервером";
		lw_loading = "Завантаження...";
		lw_sure_txt.text = "Ви впевнені, що хочете вийти?";
		lw_FacebookNull_title = "Facebook null";
		lw_FacebookNull_description = "Будь ласка, відправте лист про цю помилку в вікні Опції";
		lw_FacebookError_title = "Facebook error";
		lw_FacebookError_description = "Будь ласка, відправте лист про цю помилку в вікні Опції";
		lw_FacebookCancelled_title = "Facebook cancelled";
		lw_FacebookCancelled_description = "Ви відмінили логін із Facebook";
		lw_FacebookUndefined_title = "Facebook undefined";
		lw_FacebookUndefined_description = "Будь ласка, відправте лист про цю помилку в вікні Опції";
		lw_loginWith = "Увійти з...";
		lw_password_not_correct_description = "Паролі не співпадають";


		ma_logout_btn.text = "Вийти";
		ma_login_btn.text = "Увійти";
		//ma_single_btn.text = "Одиночна";
		//ma_multiplayer_btn.text = "Змагання";
		//ma_shop_btn.text = "Магазин";
		//ma_ratings_btn.text = "Рейтинги";
		//ma_options_btn.text = "Опції";
		ma_hello_txt.text = "Привіт";
		ma_login_to_play = "Увійдіть, щоб грати у поєдинок";
		//ma_yes_btn.text = "Так";
		//ma_no_btn.text = "Ні";
		ma_sure_txt.text = "Ви впевнені, що хочете вийти?";

		so_tutorial_btn.text = "Настанови";
		so_classic_btn.text = "Класика";
		so_campain_btn.text = "Місії";
		so_classicLocked_txt.text = "Пройдіть місії щоб відкрити класичний режим";

//		si_back_btn.text = "Назад";
		si_start_btn.text = "Старт";
		si_map_txt.text = "Карта";
//		si_side_txt.text = "Обери сторону";
//		si_upgrades_txt.text = "Удосконалення";
//		si_u_ship_txt.text = "Корабель";
//		si_u_submarine_txt.text = "Субмарина";
		si_submarine_off.text = "Ви повинні виграти 5 ігор, граючи за корабель, щоб розблокувати субмарину";
		si_ship_off.text = "Ви повинні виграти цю місію за субмарину щоб розблокувати корабель і 6 місію";

//		ca_back_btn.text = "Назад";
		ca_start_btn.text = "Старт";
//		ca_side_txt.text = "Обери сторону";
//		ca_upgrades_txt.text = "Удосконалення";
//		ca_u_ship_txt.text = "Корабель";
//		ca_u_submarine_txt.text = "Субмарина";
		ca_submarine_off.text = "Ви повинні виграти 5 ігор, граючи за корабель, щоб розблокувати субмарину";
		ca_title.text = "Кампанія";
		//ca_first5missions.text = "Ви повинні виграти " + getFirst5Mission() + ", граючи за субмарину, щоб розблокувати наступну місію";


//		mu_back_btn.text = "Назад";
		mu_start_btn.text = "Старт";
		mu_stop_btn.text = "Стоп";
		mu_search_btn.text = "Пошук";
		mu_map_txt.text = "Карта";
		mu_online_txt.text = "Гравці онлайн";
		mu_info.text = "Оберіть суперника: карта і сторона обереться автоматично. Встаньте в чергу: карту і сторону оберете ви.";
		mu_no_internet_connection = "Немає з'єднання з інтернетом";
		mu_submarine_off.text = "Ви повинні виграти 5 ігор, граючи за корабель, щоб розблокувати субмарину";
		mu_waiting_player_map = "Карта";
		mu_waiting_player_rate = "Перемог";

//		ba_move_btn.text = "Плити";
//		ba_fire_btn.text = "Вогонь";
		//ba_use_txt.text = "Використати";
		//ba_restart_btn.text = "Рестарт";
		//ba_exit_btn.text = "Вихід";
		ba_be_ready = "Готуємось...";
		ba_your_turn = "Ваш хід";
		ba_enemy_turn = "Хід суперника";
		//ba_lifes_txt.text = "Життя:";
		ba_time_txt.text = "Час:";
		ba_move_txt.text = "Ходи:";
		ba_enemy_left_match_title = "Перемога!";
		ba_enemy_left_match = "Ваш суперник покинув матч";
		ba_server_error_title = "Помилка";
		ba_server_error = "Сервер не відповідає";
		ba_quit_txt.text = "Ви впевнені, що хочете вийти?";
//		ba_yes_txt.text = "Так";
//		ba_no_txt.text = "Ні";
		ba_history_txt.text = "Історія";
		ba_setBomb_txt = "Спочатку оберіть клітинку для міни, потім нажміть на неї щоб застосувати";
		ba_settedBomb_txt = "Ви вже використали міну";
		ba_more_title.text = "Ще?";
		ba_more_question.text = "Ви хочете зіграти ще раз зі своїм суперником?";
		ba_more_waiting.text = "Очікування відповіді";
		ba_more_nope.text = "Суперник відмовився від гри з вами";

		//ra_all_time.text = "За весь час";
		//ra_mounth.text = "За місяць";
		//ra_week.text = "За тиждень";
//		ra_refresh_btn.text = "Оновити";
//		ra_back_btn.text = "Назад";
		ra_1st_txt = "Власник корони - Морський Король! Він отримує 20 золота кожен день";
		ra_map_txt.text = "Карта";

//		sh_back_btn.text = "Назад";
		sh_Item1.text = "Міна";
		sh_Item2.text = "Броня";
		sh_Item3.text = "Радар";
		sh_Item4.text = "Супер-удар";
		sh_Item5.text = "Броня";
		sh_Item1_description = "Міна знищує субмарину, якщо та напливає на неї";
		sh_Item2_description = "Дає додаткове життя кораблю";
		sh_Item3_description = "Прибирає неможливі позиції субмарини";
		sh_Item4_description = "Дає можливість знищити корабель на відстані двох клітинок";
		sh_Item5_description = "Дає додаткове життя субмарині";
		sh_Gold_description = "Монети потрібні щоб купити корисні бустери. Ви можете купити їх або отримати, перемагаючи в боях";
		sh_your_items_txt.text = "Магазин";
		sh_buyed = "Куплено";
		sh_buy = "Купити";
		sh_Error_title.text = "Вибачте";
		sh_not_enouth_coins = "У вас недостатньо монет";
		sh_already_buyed = "Ви вже купили цей апгрейд";
		sh_not_connected = "Ви не увійшли";
		//sh_single_txt.text = "Купити одноразовий мод";
		//sh_permanent_txt.text = "Купити мод перманентно";
		sh_Upgrades.text = "Покращення";
		sh_put_on = "Взяти";
		sh_put_off = "Залишити";
		gold1.text = BuyFunctions.Gold1_coins + " монет";
		gold2.text = BuyFunctions.Gold2_coins + " монет";
		gold3.text = BuyFunctions.Gold3_coins + " монет";
		sh_coins = "Монет";
		sh_add_gold_txt.text = "Додати монет?";

//		op_back_btn.text = "Назад";
		op_language_txt.text = "Мова";
		op_sound_txt.text = "Звуки";
		op_music_txt.text = "Музика";
		op_tips_txt.text = "Підказки";
		op_bug_txt.text = "Відгук";
		op_comunity.text = "Спільнота";
		op_letter_txt.text = "Лист";
//		op_ok_btn.text = "Надіслати";
		op_ok2_btn.text = "Будь ласка";
//		op_cancel_btn.text = "Відміна";
		op_thank_txt.text = "Дякую!";
		op_enter_text = "Не можу відіслати пустого листа";
		op_about_txt.text = "Про нас";
		op_about_text_txt.text = "Автор ідеї:\nКостянтин Самгін\n\nПрограміст:\nДанилюк Віталій\n\nГейм дизайнер:\nДенис Моторин\n\nХудожник:\nМарія Андрусева\n\nТестувальник:\nАндрій Олійник\n\nМузика\nКостянтин Impeh Лащенко\nОлександр Sandro Нелипа";
		op_about_title_txt.text = "Про нас";

//		re_ok_btn.text = "Гаразд";
		re_victory = "Перемога!";
		re_defeat = "Поразка!";
		re_sh_win = "Ви перемогли, граючи за корабель";
		re_su_win = "Ви перемогли, граючи за субмарину";
		re_sh_defeat = "Вы програли, граючи за корабель";
		re_su_defeat = "Вы програли, граючи за субмарину";
		re_out_of_moves = "Ходи вичерпані";
		re_moves.text = "Ходів:";
		re_gold.text = "Золото:";
		re_login.text = "Увійти";
		re_sorry = "Вибачте";
		re_under_construction = "В розробці...";

		tips = new List<string> ();
		tips.Add ("Підказка: Сканер для корабля прибирає неможливі позиції для субмарини");
		tips.Add ("Підказка: Використовуйте міну щоб захистити свої фланги");
		tips.Add ("Підказка: Аналізуйте суперника, щоб передбачити його хід");
		tips.Add ("Підказка: Використовуйте ваш обліковий запис і в інших іграх компанії 'Rozum Games'");
		tips.Add ("Підказка: Кількість ваших ходів впливає на ваш рейтинг");


		//Tutorial.text = "Настанови";
		Slide1 = "Субмарина завжди ходить першою. Вона пересувається на одну клітинку кожен хід";
		Slide2 = "Граючи за корабель, спочатку клікніть на клітинку, де імовірно може знаходитись субмарина";
		Slide3 = "Потім клікніть для пострілу";
		Slide4 = "Після пострілу, будуть перевірені всі клітинки по горизонталі і вертикалі...";
		Slide5 = "... і по двох діагоналях";
		Slide6 = "Якщо ви промахнулись, в клітинці буде показано відстань до субмарини";
		Slide7 = "Клітинки, на відповідних відстанях будуть підсвічені як можливе місцезнаходження субмарини";
		Slide8 = "Настає хід субмарини і вона перепливає на іншу клітинку";
		Slide9 = "Тому не розраховуйте на те, що субмарина залишається на місці, а наступного ходу намагайтеся спрогнозувати її рух";
		Slide10 = "Мета субмарини - доплисти до корабля на відстань однієї клітинки";
		Slide11 = "Якщо на перевірених лініях субмарини не виявиться, ви побачите '0' в цій клітинці";
		tu_Text.text = "Ви пройшли тренування";

		wh_title.text = "Штурвал";
		wh_watch_btn.text = "Дивитись";
		wh_wheel_btn.text = "Крутити";
		wh_time_error.text = "Час ще не прийшов";
		wh_aviable_error.text = "Вибачте, відео зараз недоступно";
		wh_aviabe = "Готовий крутити!";
		wh_minutes_left = " хвилин залишилось";

		Mission11 = "Лише в цій місії корабель бачить субмарину. Стріляйте на випередження!";
		Mission12 = "У вас є лише 10 кроків";
		Mission13 = "Субмарина отримує безкоштовну покращену броню, корабель отримує безкоштовну міну";
		Mission14 = "Субмарина з'являється на випадковому місці серед двох можливих";
		Mission15 = "Корабель і субмарина з'являється у випадковому місці серед трьох можливих";
		Mission16 = "Корабель отримує безкоштовну покращену броню, субмарина отримує Супер-удар";
		Mission17 = "Ворожа субмарина з'являється на випадковому місці серед двох можливих. Ваша субмарина на одному";
		Mission18 = "Субмарина з'являється на випадковому місці серед двох можливих";
		Mission19 = "Корабель і субмарина з'являється у випадковому місці серед чотирьох можливих";

		tadam1 = "Ви щойно перемогли у своїй першій битві";
		tadam2 = "Ви заробили достатньо золота щоб купити свій перший бустер - Радар";
		tadam3 = "Ви 5 разів перемогли, граючи за корабель, тепер ви можете зіграти за субмарину";
		tadam4 = "Ви пройшли всі місії! Тепер ви можете зіграти в Мультиплеєр з іншими гравцями";
		tadam5 = "Вдала покупка";
		tadam6 = "Ви отримали нагороду! Повертайтеся через годину і вигравайте ще!";
		tadam7 = "";
		tadam8 = "";
		Tadam_title.text = "Вітаю!";
	}
Exemplo n.º 19
0
	public void SetRussian()
	{
		CurrentLanguage = languages.russian;

		lw_enter_login.text = "Введите логин";
		lw_enter_password.text = "Введите пароль";
		lw_confirm_password.text = "Повторите пароль";
		lw_Login_btn.text = "Войти";
		lw_Enter_tab.text = "Войти";
		lw_Reg_tab.text = "Регистрация";
		//lw_DoReg_btn.text = "Зарегистрироваться";
		//lw_NoReg_btn.text = "Вход без регистрации";
//		lw_Back_btn.text = "Регистрация";
		lw_error_header = "Ошибка";
		lw_incorrect = "Логин/Пароль неверный";
		lw_connection = "Нет соединения с сервером";
		lw_loading = "Загрузка...";
		lw_sure_txt.text = "Вы уверены, что хотите выйти?";
		lw_FacebookNull_title = "Facebook null";
		lw_FacebookNull_description = "Пожалуйста, отправьте письмо об этой ошибке в окне Опции";
		lw_FacebookError_title = "Facebook error";
		lw_FacebookError_description = "Пожалуйста, отправьте письмо об этой ошибке в окне Опции";
		lw_FacebookCancelled_title = "Facebook cancelled";
		lw_FacebookCancelled_description = "Вы отменили логин из Facebook";
		lw_FacebookUndefined_title = "Facebook undefined";
		lw_FacebookUndefined_description = "Пожалуйста, отправьте письмо об этой ошибке в окне Опции";
		lw_loginWith = "Войти с...";
		lw_password_not_correct_description = "Пароли не совпадают";

		ma_logout_btn.text = "Выйти";
		ma_login_btn.text = "Войти";
		//ma_single_btn.text = "Одиночная";
		//ma_multiplayer_btn.text = "Соревнование";
		//ma_shop_btn.text = "Магазин";
		//ma_ratings_btn.text = "Рейтинги";
		//ma_options_btn.text = "Опции";
		ma_hello_txt.text = "Привет";
		ma_login_to_play = "Войдите, чтобы играть в соревнование";
		//ma_yes_btn.text = "Да";
		//ma_no_btn.text = "Нет";
		ma_sure_txt.text = "Вы уверены, что хотите выйти?";

		so_tutorial_btn.text = "Обучение";
		so_classic_btn.text = "Классика";
		so_campain_btn.text = "Миссии";
		so_classicLocked_txt.text = "Пройдите все миссии, чтобы открыть классический режим";

//		si_back_btn.text = "Назад";
		si_start_btn.text = "Старт";
		si_map_txt.text = "Карта";
//		si_side_txt.text = "Выбери сторону";
//		si_upgrades_txt.text = "Улучшения";
//		si_u_ship_txt.text = "Корабль";
//		si_u_submarine_txt.text = "Подлодка";
		si_submarine_off.text = "Вы должны выиграть 5 игр, играя за корабль, чтобы разблокировать подлодку";
		si_ship_off.text = "Вы должны выиграть эту миссию за подлодку чтобы разблокировать корабль и 6 миссию";

//		ca_back_btn.text = "Назад";
		ca_start_btn.text = "Старт";
//		ca_side_txt.text = "Выбери сторону";
//		ca_upgrades_txt.text = "Улучшения";
//		ca_u_ship_txt.text = "Корабль";
//		ca_u_submarine_txt.text = "Подлодка";
		ca_submarine_off.text = "Вы должны выиграть 5 игр, играя за корабль, чтобы разблокировать подлодку";
		ca_title.text = "Кампания";
		//ca_first5missions.text = "Вы должны выиграть " + getFirst5Mission() + ", играя за подлодку, чтобы разблокировать следующую миссию";

//		mu_back_btn.text = "Назад";
		mu_start_btn.text = "Старт";
		mu_stop_btn.text = "Стоп";
		mu_search_btn.text = "Поиск";
		mu_map_txt.text = "Карта";
		mu_online_txt.text = "Игроки онлайн";
		mu_info.text = "Выберите противника: карта и сторона выбирается автоматически. Встаньте в очередь: карту и сторону выберите вы.";
		mu_no_internet_connection = "Нет соединения с интернетом";
		mu_submarine_off.text = "Вы должны выиграть 5 игр, играя за корабль, чтобы разблокировать подлодку";
		mu_waiting_player_map = "Карта";
		mu_waiting_player_rate = "Побед";

//		ba_move_btn.text = "Плыть";
//		ba_fire_btn.text = "Огонь";
//		ba_use_txt.text = "Использовать";
//		ba_restart_btn.text = "Рестарт";
//		ba_exit_btn.text = "Выход";
		ba_be_ready = "Готовимся...";
		ba_your_turn = "Ваш ход";
		ba_enemy_turn = "Ход противника";
		//ba_lifes_txt.text = "Жизни:";
		ba_time_txt.text = "Время:";
		ba_move_txt.text = "Ходы:";
		ba_enemy_left_match_title = "Победа!";
		ba_enemy_left_match = "Ваш противник покинул матч";
		ba_server_error_title = "Ошибка";
		ba_server_error = "Сервер не отвечает";
		ba_quit_txt.text = "Вы уверены, что хотите выйти?";
		//ba_yes_txt.text = "Да";
		//ba_no_txt.text = "Нет";
		ba_history_txt.text = "История";
		ba_setBomb_txt = "Сначала выберите ячейку для мины, потом нажмите на неё чтобы исспользовать";
		ba_settedBomb_txt = "Вы уже использовали мину";
		ba_more_title.text = "Ещё?";
		ba_more_question.text = "Вы хотите сыграть ещё раз с этим соперником?";
		ba_more_waiting.text = "Ожидание ответа";
		ba_more_nope.text = "Соперник отказался от игры с вами";


		//ra_all_time.text = "За все время";
		//ra_mounth.text = "За месяц";
		//ra_week.text = "За неделю";
//		ra_refresh_btn.text = "Обновить";
//		ra_back_btn.text = "Назад";
		ra_1st_txt = "Обладатель короны - Морской Король! Он получает 20 золота каждый день";
		ra_map_txt.text = "Карта";

//		sh_back_btn.text = "Назад";
		sh_Item1.text = "Мина";
		sh_Item2.text = "Броня";
		sh_Item3.text = "Радар";//
		sh_Item4.text = "Супер-удар";
		sh_Item5.text = "Броня";
		sh_Item1_description = "Мина уничтожает подлодку, если та наплывает на неё";
		sh_Item2_description = "Дает дополнительную жизнь кораблю";
		sh_Item3_description = "Удаляет невозможные позиции подлодки";//
		sh_Item4_description = "Дает возможность уничтожить корабль на расстоянии двух ячеек";
		sh_Item5_description = "Дает дополнительную жизнь подлодке";
		sh_Gold_description = "Монеты нужны чтобы купить полезные бустеры. Вы можете купить их или получить, побеждая в сражениях";
		sh_your_items_txt.text = "Магазин";
		sh_buyed = "Куплено";
		sh_buy = "Купить";
		sh_Error_title.text = "Извините";
		sh_not_enouth_coins = "У вас недостаточно монет";
		sh_already_buyed = "Вы уже приобрели это улучшение";
		sh_not_connected = "Вы не вошли";
		//sh_single_txt.text = "Купить одноразовое улучшение";
		//sh_permanent_txt.text = "Купить улучшение перманентно";
		sh_Upgrades.text = "Улучшения";
		sh_put_on = "Взять";
		sh_put_off = "Оставить";
		gold1.text = BuyFunctions.Gold1_coins + " монет";
		gold2.text = BuyFunctions.Gold2_coins + " монет";
		gold3.text = BuyFunctions.Gold3_coins + " монет";
		sh_coins = "Монет";
		sh_add_gold_txt.text = "Добавить монет?";

//		op_back_btn.text = "Назад";
		op_language_txt.text = "Язык";
		op_sound_txt.text = "Звуки";
		op_music_txt.text = "Музыка";
		op_tips_txt.text = "Подсказки";
		op_bug_txt.text = "Отзыв";
		op_comunity.text = "Сообщество";
		op_letter_txt.text = "Письмо";
//		op_ok_btn.text = "Отправить";
		op_ok2_btn.text = "Пожалуйста";
//		op_cancel_btn.text = "Отмена";
		op_thank_txt.text = "Спасибо!";
		op_enter_text = "Не могу отправить пусте письмо";
		op_about_txt.text = "О нас";
		op_about_text_txt.text = "Автор идеи:\nКонстантин Самгин\n\nПрограммист:\nДанилюк Виталий\n\nГейм дизайнер:\nДенис Моторин\n\nХудожник:\nМария Андрусева\n\nТестировщик:\nАндрей Олейник\n\nМузыка\nКонстантин Impeh Лащенко\nАлександр Sandro Нелипа";
		op_about_title_txt.text = "О нас";

//		re_ok_btn.text = "Хорошо";
		re_victory = "Победа!";
		re_defeat = "Поражение!";
		re_sh_win = "Вы одержали победу, играя за корабль";
		re_su_win = "Вы одержали победу, играя за подлодку";
		re_sh_defeat = "Вы получили поражение, играя за корабль";
		re_su_defeat = "Вы получили поражение, играя за подлодку";
		re_out_of_moves = "Ходы исчерпаны";
		re_moves.text = "Ходов:";
		re_gold.text = "Золото:";
		re_login.text = "Войти";
		re_sorry = "Извините";
		re_under_construction = "В разработке...";

		tips = new List<string> ();
		tips.Add ("Подсказка: Сканер для корабля убирает невозможные позиции для подлодки");
		tips.Add ("Подсказка: Используйте мину чтобы защитить свои фланги");
		tips.Add ("Подсказка: Анализируйте противника, чтобы предугадать его ход");
		tips.Add ("Подсказка: Используйте ваш аккаунт и в других играх компании 'Rozum Games'");
		tips.Add ("Подсказка: Количество ваших ходов влияет на ваш рейтинг");

		//Tutorial.text = "Обучение";
		Slide1 = "Подлодка всегда ходит первой. Она передвигается на одну клетку каждый ход";
		Slide2 = "Играя за корабль, сначала кликните на ячейку, где предположительно может находиться подлодка";
		Slide3 = "Затем кликните для выстрела";
		Slide4 = "После выстрела, будут проверены все ячейки по горизонтали и вертикали...";
		Slide5 = "... и по двум диагоналям";
		Slide6 = "Если вы промахнулись, в ячейке будет показано расстояние до подлодки";
		Slide7 = "Клетки, на соответствующих расстояниях будут подсвечены как возможное местонахождение подлодки";
		Slide8 = "Наступает ход подлодки и она переплывает на другую ячейку";
		Slide9 = "Поэтому не расcчитывайте на то, что подлодка останется на месте, а в следующем пытайтесь спрогнозировать её движение";
		Slide10 = "Цель подлодки - доплыть до корабля на расстояние одной ячейки";
		Slide11 = "Если на проверенных линиях подлодки не окажется, вы увидите '0' в этой ячейке";
		tu_Text.text = "Вы прошли обучение";

		wh_title.text = "Штурвал";
		wh_watch_btn.text = "Смотреть";
		wh_wheel_btn.text = "Крутить";
		wh_time_error.text = "Время ещё не пришло";
		wh_aviable_error.text = "Извините, видео сейчас недоступно";
		wh_aviabe = "Готов крутить!";
		wh_minutes_left = " минут осталось";

		Mission11 = "Только в этой миссии корабль видит подлодку. Стреляйте на опережение!";
		Mission12 = "У вас есть только 10 шагов";
		Mission13 = "Подлодка получает бесплатную броню, корабль получает бесплатную мину";
		Mission14 = "Подлодка появляется в случайном из двух мест на карте";
		Mission15 = "Корабль и подлодка может появиться в одном из трех случайных мест";
		Mission16 = "Корабль получает бесплатную броню, подлодка получает Супер-удар";
		Mission17 = "Вражеская подлодка появляется в случайном из двух мест на карте. Ваша подлодка на одном";
		Mission18 = "Подлодка появляется в случайном из двух мест на карте";
		Mission19 = "Корабль и подлодка может появиться в одном из четырех случайных мест";

		tadam1 = "Вы выиграли свою первую миссию и получили награду!";
		tadam2 = "Вы заработали достаточно монет, чтобы купить свой первый бустер - Радар";
		tadam3 = "Вы прошли 5 миссий и теперь можете играть за подлодку";
		tadam4 = "Вы прошли все миссии! Теперь Вы можете сразится в режиме Multiplayer с реальными игроками";
		tadam5 = "Покупка произведена успешно";
		tadam6 = "Вы получили награду! Возвращайтесь через час и выигрывайте еще!";
		tadam7 = "";
		tadam8 = "";
		Tadam_title.text = "Поздрвляю!";
	}
Exemplo n.º 20
0
	public void SetEnglish()
	{
		CurrentLanguage = languages.english;

		lw_enter_login.text = "Enter login";
		lw_enter_password.text = "Enter password";
		lw_confirm_password.text = "Confirm password";
		lw_Login_btn.text = "Login";
		lw_Enter_tab.text = "Login";
		lw_Reg_tab.text = "Registration";
//		lw_DoReg_btn.text = "Registrate";
//		lw_NoReg_btn.text = "Enter without registration";
//		lw_Back_btn.text = "Registration";
		lw_error_header = "Error";
		lw_incorrect = "Login/Password is incorrect";
		lw_connection = "Could not connect to server";
		lw_loading = "Loading...";
		lw_sure_txt.text = "Are you sure you want to logout?";
		lw_FacebookNull_title = "Facebook null";
		lw_FacebookNull_description = "Please send bug report about this on Options window";
		lw_FacebookError_title = "Facebook error";
		lw_FacebookError_description = "Please send bug report about this on Options window";
		lw_FacebookCancelled_title = "Facebook cancelled";
		lw_FacebookCancelled_description = "You cancelled login from Facebook";
		lw_FacebookUndefined_title = "Facebook undefined";
		lw_FacebookUndefined_description = "Please send bug report about this on Options window";
		lw_loginWith = "Login with...";
		lw_password_not_correct_description = "Passwords doesn't match";

		ma_logout_btn.text = "Logout";
		ma_login_btn.text = "Login";
		//ma_single_btn.text = "Single";
		//ma_multiplayer_btn.text = "Multiplayer";
		//ma_shop_btn.text = "Shop";
		//ma_ratings_btn.text = "Ratings";
		//ma_options_btn.text = "Options";
		ma_hello_txt.text = "Hello";
		ma_login_to_play = "Login to play multiplayer";
		//ma_yes_btn.text = "Yes";
		//ma_no_btn.text = "No";
		ma_sure_txt.text = "Are you sure you want to quit?";

		so_tutorial_btn.text = "Tutorial";
		so_classic_btn.text = "Classic";
		so_campain_btn.text = "Missions";
		so_classicLocked_txt.text = "Complete missions to unlock classic mode";

//		si_back_btn.text = "Back";
		si_start_btn.text = "Start";
		si_map_txt.text = "Map";
//		si_side_txt.text = "Choose side";
//		si_upgrades_txt.text = "Upgrades";
//		si_u_ship_txt.text = "Ship";
//		si_u_submarine_txt.text = "Submarine";
		si_submarine_off.text = "You must win 5 games as ship to unlock submarine";
		si_ship_off.text = "You must win this mission as submarine to unlock ship and 6th mission";

//		ca_back_btn.text = "Back";
		ca_start_btn.text = "Start";
//		ca_side_txt.text = "Choose side";
//		ca_upgrades_txt.text = "Upgrades";
//		ca_u_ship_txt.text = "Ship";
//		ca_u_submarine_txt.text = "Submarine";
		ca_submarine_off.text = "You must win 5 games as ship to unlock submarine";
		ca_title.text = "Campaign";
		//ca_first5missions.text = "You must win " + getFirst5Mission() + " as submarine to unlock next mission";

//		mu_back_btn.text = "Back";
		mu_start_btn.text = "Start";
		mu_stop_btn.text = "Stop";
		mu_search_btn.text = "Search";
		mu_map_txt.text = "Map";
		mu_online_txt.text = "Players online";
		mu_info.text = "Select an enemy: map and side will be automatically selected. Stand in the query: map and side will be selected manualy.";
		mu_no_internet_connection = "No internet connection";
		mu_submarine_off.text = "You must win 5 games as ship to unlock submarine";
		mu_waiting_player_map = "Map";
		mu_waiting_player_rate = "Wins";

//		ba_move_btn.text = "Move";
//		ba_fire_btn.text = "Fire";
		//ba_use_txt.text = "Use";
		//ba_restart_btn.text = "Restart";
		//ba_exit_btn.text = "Exit";
		ba_be_ready = "Be ready...";
		ba_your_turn = "Your turn";
		ba_enemy_turn = "Enemy turn";
		//ba_lifes_txt.text = "Lifes:";
		ba_time_txt.text = "Time:";
		ba_move_txt.text = "Moves:";
		ba_enemy_left_match_title = "Victory!";
		ba_enemy_left_match = "Your opponent has left the matсh";
		ba_server_error_title = "Error";
		ba_server_error = "Server has not response";
		ba_quit_txt.text = "Are you sure you want to quit?";
//		ba_yes_txt.text = "Yes";
//		ba_no_txt.text = "No";
		ba_history_txt.text = "History";
		ba_setBomb_txt = "You must select target cell before using mine";
		ba_settedBomb_txt = "You already setted the mine";
		ba_more_title.text = "More?";
		ba_more_question.text = "Do you want to play again with this rival?";
		ba_more_waiting.text = "Waiting for response";
		ba_more_nope.text = "The rival refused to play with you";

		//ra_all_time.text = "All time";
		//ra_mounth.text = "Month";
		//ra_week.text = "Week";
//		ra_refresh_btn.text = "Refresh";
//		ra_back_btn.text = "Back";
		ra_1st_txt = "Crown owner is a Sea King! He recives 20 gold every day";
		ra_map_txt.text = "Map";

//		sh_back_btn.text = "Back";
		sh_Item1.text = "Mine";
		sh_Item2.text = "Armor";
		sh_Item3.text = "Radar";
		sh_Item4.text = "Power shot";
		sh_Item5.text = "Armor";
		sh_Item1_description = "Mine destroys submarine if it moves on it";
		sh_Item2_description = "Gives additional life for ship";
		sh_Item3_description = "Removes impossible submarine position";//
		sh_Item4_description = "Gives posibility to destroy ship in two cells range";
		sh_Item5_description = "Gives additional life for submarine";
		sh_Gold_description = "The coins need to buy useful boosters. You can buy them or get by winning battles.";
		sh_your_items_txt.text = "Shop";
		sh_buyed = "Buyed";
		sh_buy = "Buy";
		sh_Error_title.text = "Sorry";
		sh_not_enouth_coins = "You have not enough coins";
		sh_already_buyed = "You have already buyed this upgrade";
		sh_not_connected = "You are not connected";
		//sh_single_txt.text = "Buy single enhancement";
		//sh_permanent_txt.text = "Buy enhancement permanent";
		sh_Upgrades.text = "Upgrades";
		sh_put_on = "Take";
		sh_put_off = "Leave";
		gold1.text = BuyFunctions.Gold1_coins + " coins";
		gold2.text = BuyFunctions.Gold2_coins + " coins";
		gold3.text = BuyFunctions.Gold3_coins + " coins";
		sh_coins = "Coins";
		sh_add_gold_txt.text = "Add gold?";

//		op_back_btn.text = "Back";
		op_language_txt.text = "Language";
		op_sound_txt.text = "Sound";
		op_music_txt.text = "Music";
		op_tips_txt.text = "Tips";
		op_bug_txt.text = "Feedback";
		op_comunity.text = "Community";
		op_letter_txt.text = "Letter";
//		op_ok_btn.text = "Send";
		op_ok2_btn.text = "You are welcome";
//		op_cancel_btn.text = "Cancel";
		op_thank_txt.text = "Thank you!";
		op_enter_text = "Can't send empty letter";
		op_about_txt.text = "About us";
		op_about_text_txt.text = "Author of the idea:\nKonstantin Samgin\n\nProgrammer:\nDanyluk Vitali\n\nGame designer:\nDenis Motorin\n\nArtist:\nMaria Andruseva\n\nTester:\nAndrey Oleynik\n\nMusic\nKonstantin Impeh Lashchenko\nAlexander Sandro Nelipa";
		op_about_title_txt.text = "About us";

//		re_ok_btn.text = "OK";
		re_victory = "Victory!";
		re_defeat = "Defeat!";
		re_sh_win = "You won as ship";
		re_su_win = "You won as submarine";
		re_sh_defeat = "You lose as ship";
		re_su_defeat = "You lose as submarine";
		re_out_of_moves = "Out of moves";
		re_moves.text = "Moves:";
		re_gold.text = "Gold:";
		re_login.text = "Login";
		re_sorry = "Sorry";
		re_under_construction = "Under construction...";



		tips = new List<string> ();
		tips.Add ("Tip: Scanner for the ship removes impossible position for the submarine");
		tips.Add ("Tip: Use mine to protect your wings");
		tips.Add ("Tip: Analyze the enemy to predict its course");
		tips.Add ("Tip: Use your account in other games of 'Rozum Games'");
		tips.Add ("Tip: The number of your turns affects your ranking");

		//Tutorial.text = "Tutorial";
		Slide1 = "Submarine always goes first. She moves to one cell each time";
		Slide2 = "Playing as ship, first of all click to cell, where perhaps may be submarine";
		Slide3 = "Then click for shoot";
		Slide4 = "After shoot, cells at horizontal and vertical will be checked...";
		Slide5 = "... and two diagonals";
		Slide6 = "If you missed, cell will contain number with distance to submarine";
		Slide7 = "The cells on the respective distances will be highlighted as a possible location of the submarine";
		Slide8 = "It is the turn of the submarine and she swims to another cell";
		Slide9 = "So do not count on the fact that the submarine is still in place, but at next turn try to predict her movement";
		Slide10 = "The purpose of the submarine - swim to the ship at a distance of one cell";
		Slide11 = "If on checked lines will be no submarine, you will see '0' value of distance";
		tu_Text.text = "You have been trained";

		wh_title.text = "Wheel";
		wh_watch_btn.text = "Watch";
		wh_wheel_btn.text = "Spin";
		wh_time_error.text = "Time has not come";
		wh_aviable_error.text = "Sorry, no ads aviable";
		wh_aviabe = "Ready to spin!";
		wh_minutes_left = " minutes left";

		Mission11 = "Only in this mission ship can see submarine. Move outrunning!";
		Mission12 = "You have only 10 moves";
		Mission13 = "Submarine have free heavy armor, Ship have free mine";
		Mission14 = "Submarine can appear randomly in two cells";
		Mission15 = "Ship and Submarine can appear randomly in three cells";
		Mission16 = "Ship have free heavy armor, Submarine have free Power shot";
		Mission17 = "Enemy submarine can appear randomly in two cells. Your submarine in one";
		Mission18 = "Submarine can appear randomly in two cells";
		Mission19 = "Ship and Submarine can appear randomly in four cells";

		tadam1 = "You just won your first battle";
		tadam2 = "You earned enough money to buy your first booster - radar";
		tadam3 = "You won 5 games as ship, now you can play as submarine";
		tadam4 = "You won all mission, now you can play in Multiplayer mode with other players";
		tadam5 = "Purchase successful";
		tadam6 = "You got an award! Go back after one hour and win more!";
		tadam7 = "";
		tadam8 = "";
		Tadam_title.text = "Congratulations!";
	}
Exemplo n.º 21
0
        public async Task SQL_answerValues_Create_DoesCreate()
        {
            // Arrange
            Random rnd   = new Random();
            sites  site1 = await testHelpers.CreateSite(Guid.NewGuid().ToString(), rnd.Next(1, 255));

            units unit1 = await testHelpers.CreateUnit(rnd.Next(1, 255), rnd.Next(1, 255), site1, rnd.Next(1, 255));

            languages language = new languages
            {
                Name = Guid.NewGuid().ToString(), Description = Guid.NewGuid().ToString()
            };
            await language.Create(dbContext).ConfigureAwait(false);

            #region QuestionSet
            string        name        = Guid.NewGuid().ToString();
            question_sets questionSet = new question_sets
            {
                Name = name, Share = false, HasChild = false, PosiblyDeployed = false
            };
            await questionSet.Create(dbContext).ConfigureAwait(false);

            #endregion

            #region surveyConfiguration

            survey_configurations surveyConfiguration = new survey_configurations
            {
                Name          = Guid.NewGuid().ToString(),
                Stop          = DateTime.Now,
                Start         = DateTime.Now,
                TimeOut       = rnd.Next(1, 255),
                TimeToLive    = rnd.Next(1, 255),
                QuestionSetId = questionSet.Id
            };
            await surveyConfiguration.Create(dbContext).ConfigureAwait(false);

            #endregion

            #region Answer

            answers answer = new answers
            {
                SiteId                = site1.Id,
                QuestionSetId         = questionSet.Id,
                SurveyConfigurationId = surveyConfiguration.Id,
                UnitId                = unit1.Id,
                TimeZone              = Guid.NewGuid().ToString(),
                FinishedAt            = DateTime.Now,
                LanguageId            = language.Id,
                AnswerDuration        = rnd.Next(1, 255),
                UtcAdjusted           = true
            };
            await answer.Create(dbContext).ConfigureAwait(false);


            #endregion

            #region question
            string    type          = Guid.NewGuid().ToString();
            string    questionType  = Guid.NewGuid().ToString();
            string    imagePosition = Guid.NewGuid().ToString();
            string    fontSize      = Guid.NewGuid().ToString();
            questions question      = new questions
            {
                Type                 = type,
                QuestionType         = questionType,
                ImagePosition        = imagePosition,
                FontSize             = fontSize,
                QuestionSetId        = questionSet.Id,
                Maximum              = rnd.Next(1, 255),
                Minimum              = rnd.Next(1, 255),
                RefId                = rnd.Next(1, 255),
                MaxDuration          = rnd.Next(1, 255),
                MinDuration          = rnd.Next(1, 255),
                QuestionIndex        = rnd.Next(1, 255),
                ContinuousQuestionId = rnd.Next(1, 255),
                Prioritised          = false,
                ValidDisplay         = false,
                BackButtonEnabled    = false,
                Image                = false
            };
            await question.Create(dbContext).ConfigureAwait(false);

            #endregion

            #region Option

            options option = new options
            {
                WeightValue        = rnd.Next(1, 255),
                QuestionId         = question.Id,
                Weight             = rnd.Next(1, 255),
                OptionsIndex       = rnd.Next(1, 255),
                NextQuestionId     = rnd.Next(1, 255),
                ContinuousOptionId = rnd.Next(1, 255)
            };
            await option.Create(dbContext).ConfigureAwait(false);

            #endregion

            answer_values answerValue = new answer_values
            {
                QuestionId = question.Id,
                Value      = rnd.Next(1, 255).ToString(),
                Answer     = answer,
                Option     = option,
                AnswerId   = answer.Id,
                Question   = question,
                OptionId   = option.Id
            };

            // Act
            await answerValue.Create(dbContext).ConfigureAwait(false);

            answer_values         dbAnswerValue = dbContext.answer_values.AsNoTracking().First();
            answer_value_versions dbVersion     = dbContext.answer_value_versions.AsNoTracking().First();

            // Assert
            Assert.NotNull(dbAnswerValue);
            Assert.NotNull(dbVersion);

            Assert.AreEqual(dbAnswerValue.QuestionId, answerValue.QuestionId);
            Assert.AreEqual(dbAnswerValue.AnswerId, answerValue.AnswerId);
            Assert.AreEqual(dbAnswerValue.OptionId, answerValue.OptionId);
            Assert.AreEqual(dbAnswerValue.Value, answerValue.Value);
        }
        public async Task OptionTranslation_Delete_DoesDelete()
        {
            //Arrange

            Random rnd = new Random();

            bool randomBool = rnd.Next(0, 2) > 0;

            question_sets questionSet = new question_sets
            {
                Name            = Guid.NewGuid().ToString(),
                Share           = randomBool,
                HasChild        = randomBool,
                PosiblyDeployed = randomBool
            };
            await questionSet.Create(dbContext).ConfigureAwait(false);

            questions question = new questions
            {
                Image             = randomBool,
                Maximum           = rnd.Next(1, 255),
                Minimum           = rnd.Next(1, 255),
                Prioritised       = randomBool,
                Type              = Guid.NewGuid().ToString(),
                FontSize          = Guid.NewGuid().ToString(),
                ImagePosition     = Guid.NewGuid().ToString(),
                MaxDuration       = rnd.Next(1, 255),
                MinDuration       = rnd.Next(1, 255),
                QuestionIndex     = rnd.Next(1, 255),
                QuestionType      = Guid.NewGuid().ToString(),
                RefId             = rnd.Next(1, 255),
                ValidDisplay      = randomBool,
                BackButtonEnabled = randomBool,
                QuestionSetId     = questionSet.Id
            };
            await question.Create(dbContext).ConfigureAwait(false);


            options option = new options
            {
                Weight       = rnd.Next(1, 255),
                OptionsIndex = rnd.Next(1, 255),
                WeightValue  = rnd.Next(1, 255),
                QuestionId   = question.Id
            };
            await option.Create(dbContext).ConfigureAwait(false);


            languages language = new languages
            {
                Description = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString()
            };
            await language.Create(dbContext).ConfigureAwait(false);


            option_translations optionTranslation = new option_translations
            {
                LanguageId   = language.Id,
                OptionId     = option.Id,
                Name         = Guid.NewGuid().ToString(),
                MicrotingUid = rnd.Next(1, 255)
            };
            await optionTranslation.Create(dbContext).ConfigureAwait(false);

            var oldLanguageId   = optionTranslation.LanguageId;
            var oldOptionId     = optionTranslation.OptionId;
            var oldName         = optionTranslation.Name;
            var oldMicrotingUid = optionTranslation.MicrotingUid;

            // Act
            await optionTranslation.Delete(dbContext);

            List <option_translations>         optionTranslations        = dbContext.OptionTranslations.AsNoTracking().ToList();
            List <option_translation_versions> optionTranslationVersions =
                dbContext.OptionTranslationVersions.AsNoTracking().ToList();

            // Assert

            Assert.NotNull(optionTranslations);
            Assert.NotNull(optionTranslationVersions);

            Assert.AreEqual(1, optionTranslations.Count);
            Assert.AreEqual(2, optionTranslationVersions.Count);

            Assert.AreEqual(optionTranslation.Name, optionTranslations[0].Name);
            Assert.AreEqual(optionTranslation.OptionId, optionTranslations[0].OptionId);
            Assert.AreEqual(optionTranslation.LanguageId, optionTranslations[0].LanguageId);
            Assert.AreEqual(optionTranslation.MicrotingUid, optionTranslations[0].MicrotingUid);
            Assert.AreEqual(Constants.WorkflowStates.Removed, optionTranslations[0].WorkflowState);


            Assert.AreEqual(oldName, optionTranslationVersions[0].Name);
            Assert.AreEqual(oldOptionId, optionTranslationVersions[0].OptionId);
            Assert.AreEqual(oldLanguageId, optionTranslationVersions[0].LanguageId);
            Assert.AreEqual(oldMicrotingUid, optionTranslationVersions[0].MicrotingUid);
            Assert.AreEqual(Constants.WorkflowStates.Created, optionTranslationVersions[0].WorkflowState);

            Assert.AreEqual(optionTranslation.Name, optionTranslationVersions[1].Name);
            Assert.AreEqual(optionTranslation.OptionId, optionTranslationVersions[1].OptionId);
            Assert.AreEqual(optionTranslation.LanguageId, optionTranslationVersions[1].LanguageId);
            Assert.AreEqual(optionTranslation.MicrotingUid, optionTranslationVersions[1].MicrotingUid);
            Assert.AreEqual(Constants.WorkflowStates.Removed, optionTranslationVersions[1].WorkflowState);
        }
        public async Task QuestionTranslation_Create_DoesCreate_WO_MicrotingUID()
        {
            Random rnd = new Random();

            bool randomBool = rnd.Next(0, 2) > 0;

            question_sets questionSetForQuestion = new question_sets
            {
                Name            = Guid.NewGuid().ToString(),
                Share           = randomBool,
                HasChild        = randomBool,
                ParentId        = rnd.Next(1, 255),
                PosiblyDeployed = randomBool
            };
            await questionSetForQuestion.Create(dbContext).ConfigureAwait(false);

            questions question = new questions
            {
                Image                = randomBool,
                Maximum              = rnd.Next(1, 255),
                Minimum              = rnd.Next(1, 255),
                Prioritised          = randomBool,
                Type                 = Guid.NewGuid().ToString(),
                FontSize             = Guid.NewGuid().ToString(),
                ImagePosition        = Guid.NewGuid().ToString(),
                MaxDuration          = rnd.Next(1, 255),
                MinDuration          = rnd.Next(1, 255),
                QuestionIndex        = rnd.Next(1, 255),
                QuestionType         = Guid.NewGuid().ToString(),
                RefId                = rnd.Next(1, 255),
                ValidDisplay         = randomBool,
                BackButtonEnabled    = randomBool,
                ContinuousQuestionId = rnd.Next(1, 255),
                QuestionSetId        = questionSetForQuestion.Id
            };
            await question.Create(dbContext).ConfigureAwait(false);

            languages language = new languages
            {
                Description = Guid.NewGuid().ToString(),
                Name        = Guid.NewGuid().ToString()
            };
            await language.Create(dbContext).ConfigureAwait(false);

            question_translations questionTranslation = new question_translations
            {
                LanguageId = language.Id,
                Name       = Guid.NewGuid().ToString(),
                QuestionId = question.Id
            };

            // Act
            await questionTranslation.Create(dbContext).ConfigureAwait(false);

            List <question_translations>         questionTranslations        = dbContext.QuestionTranslations.AsNoTracking().ToList();
            List <question_translation_versions> questionTranslationVersions =
                dbContext.QuestionTranslationVersions.AsNoTracking().ToList();

            // Assert

            Assert.NotNull(questionTranslations);
            Assert.NotNull(questionTranslationVersions);

            Assert.AreEqual(1, questionTranslations.Count);
            Assert.AreEqual(1, questionTranslationVersions.Count);

            Assert.AreEqual(questionTranslation.LanguageId, questionTranslations[0].LanguageId);
            Assert.AreEqual(questionTranslation.Name, questionTranslations[0].Name);
            Assert.AreEqual(questionTranslation.QuestionId, questionTranslations[0].QuestionId);
            Assert.AreEqual(null, questionTranslations[0].MicrotingUid);

            Assert.AreEqual(questionTranslation.LanguageId, questionTranslationVersions[0].LanguageId);
            Assert.AreEqual(questionTranslation.Name, questionTranslationVersions[0].Name);
            Assert.AreEqual(questionTranslation.QuestionId, questionTranslationVersions[0].QuestionId);
            Assert.AreEqual(null, questionTranslationVersions[0].MicrotingUid);
        }
Exemplo n.º 24
0
        private int? GetLangId()
        {
            string temp = Convert.ToString(Session["DIL"]);
            if (temp == "")
                temp = "tr";

            languages lang = new languages();
            var lang_id = (from lng in idc.languages
                           where lng.Exp == temp
                           select lng.Id).ToList();
            int? l_id = lang_id[0];
            return l_id;
        }
        public async Task Answers_Create_DoesCreate()
        {
            //Arrange
            Random rnd = new Random();

            bool randomBool = rnd.Next(0, 2) > 0;

            sites site = new sites
            {
                Name         = Guid.NewGuid().ToString(),
                MicrotingUid = rnd.Next(1, 255)
            };
            await site.Create(dbContext).ConfigureAwait(false);

            sites siteForUnit = new sites
            {
                Name         = Guid.NewGuid().ToString(),
                MicrotingUid = rnd.Next(1, 255)
            };
            await siteForUnit.Create(dbContext).ConfigureAwait(false);

            units unit = new units
            {
                SiteId       = siteForUnit.Id,
                CustomerNo   = rnd.Next(1, 255),
                MicrotingUid = rnd.Next(1, 255),
                OtpCode      = rnd.Next(1, 255)
            };
            await unit.Create(dbContext).ConfigureAwait(false);

            languages language = new languages
            {
                Description = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString()
            };
            await language.Create(dbContext).ConfigureAwait(false);

            question_sets questionSet = new question_sets
            {
                Name            = Guid.NewGuid().ToString(),
                Share           = randomBool,
                HasChild        = randomBool,
                PosiblyDeployed = randomBool
            };
            await questionSet.Create(dbContext).ConfigureAwait(false);

            survey_configurations surveyConfiguration = new survey_configurations
            {
                Name          = Guid.NewGuid().ToString(),
                Start         = DateTime.Now,
                Stop          = DateTime.Now,
                TimeOut       = rnd.Next(1, 255),
                TimeToLive    = rnd.Next(1, 255),
                QuestionSetId = questionSet.Id
            };
            await surveyConfiguration.Create(dbContext).ConfigureAwait(false);

            answers answer = new answers
            {
                AnswerDuration        = rnd.Next(1, 255),
                FinishedAt            = DateTime.Now,
                LanguageId            = language.Id,
                Language              = language,
                SiteId                = site.Id,
                UnitId                = unit.Id,
                QuestionSetId         = questionSet.Id,
                SurveyConfigurationId = surveyConfiguration.Id,
                TimeZone              = Guid.NewGuid().ToString(),
                UtcAdjusted           = randomBool
            };

            //Act

            await answer.Create(dbContext).ConfigureAwait(false);

            List <answers>         answers        = dbContext.answers.AsNoTracking().ToList();
            List <answer_versions> answerVersions = dbContext.answer_versions.AsNoTracking().ToList();

            //Assert

            Assert.NotNull(answers);
            Assert.NotNull(answerVersions);

            Assert.AreEqual(1, answers.Count());
            Assert.AreEqual(1, answerVersions.Count());

            Assert.AreEqual(answer.CreatedAt.ToString(), answers[0].CreatedAt.ToString());
            Assert.AreEqual(answer.Version, answers[0].Version);
//            Assert.AreEqual(answer.UpdatedAt.ToString(), answers[0].UpdatedAt.ToString());
            Assert.AreEqual(answers[0].WorkflowState, Constants.WorkflowStates.Created);
            Assert.AreEqual(answer.Id, answers[0].Id);
            Assert.AreEqual(answer.AnswerDuration, answers[0].AnswerDuration);
            Assert.AreEqual(answer.FinishedAt.ToString(), answers[0].FinishedAt.ToString());
            Assert.AreEqual(answer.LanguageId, language.Id);
            Assert.AreEqual(answer.SiteId, site.Id);
            Assert.AreEqual(answer.TimeZone, answers[0].TimeZone);
            Assert.AreEqual(answer.UnitId, unit.Id);
            Assert.AreEqual(answer.UtcAdjusted, answers[0].UtcAdjusted);
            Assert.AreEqual(answer.QuestionSetId, questionSet.Id);
            Assert.AreEqual(answer.SurveyConfigurationId, surveyConfiguration.Id);


            //Version 1
            Assert.AreEqual(answer.CreatedAt.ToString(), answerVersions[0].CreatedAt.ToString());
            Assert.AreEqual(1, answerVersions[0].Version);
//            Assert.AreEqual(answer.UpdatedAt.ToString(), answerVersions[0].UpdatedAt.ToString());
            Assert.AreEqual(answerVersions[0].WorkflowState, Constants.WorkflowStates.Created);
            Assert.AreEqual(answer.Id, answerVersions[0].AnswerId);
            Assert.AreEqual(answer.AnswerDuration, answerVersions[0].AnswerDuration);
            Assert.AreEqual(answer.FinishedAt.ToString(), answerVersions[0].FinishedAt.ToString());
            Assert.AreEqual(language.Id, answerVersions[0].LanguageId);
            Assert.AreEqual(site.Id, answerVersions[0].SiteId);
            Assert.AreEqual(answer.TimeZone, answerVersions[0].TimeZone);
            Assert.AreEqual(unit.Id, answerVersions[0].UnitId);
            Assert.AreEqual(answer.UtcAdjusted, answerVersions[0].UtcAdjusted);
            Assert.AreEqual(questionSet.Id, answerVersions[0].QuestionSetId);
            Assert.AreEqual(surveyConfiguration.Id, answerVersions[0].SurveyConfigurationId);
        }
Exemplo n.º 26
0
 void SavedLanguage()
 {
     language = (languages)System.Enum.Parse(typeof(languages), PlayerPrefs.GetString("lang", "English"));           // https://forum.unity.com/threads/saving-player-prefs-with-enums.397304/ 4th march 2018
 }