Exemplo n.º 1
0
        public void SetWordIsLearned(TypeTest typeTest, int wordId)
        {
            var word = _localData.Words.First(x => x.Id == wordId);

            switch (typeTest)
            {
            case TypeTest.EnglishCheck:
                word.IsLearnedEnglishByCheck = true;
                break;

            case TypeTest.EnglishTranslation:
                word.IsLearnedEnglishByTranslation = true;
                break;

            case TypeTest.RussianCheck:
                word.IsLearnedRussianByCheck = true;
                break;

            case TypeTest.RussianTranslation:
                word.IsLearnedRussianByTranslation = true;
                break;
            }

            _wordRepository.UpdateWord(word);
        }
        public void PropertyExists_DoubleReturned()
        {
            var obj = new TypeTest();

            var result = obj.ExtractDouble("Value", 1);

            result.Should().Be(42);
        }
        public void PropertyDoesNotExist_ToStringDoubleReturned()
        {
            var obj = new TypeTest();

            var result = obj.ExtractDouble(string.Empty, 1);

            result.Should().Be(1337);
        }
Exemplo n.º 4
0
        public ActionResult DeleteConfirmed(int id)
        {
            TypeTest typeTest = db.TypeTests.Find(id);

            db.TypeTests.Remove(typeTest);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "Id,Name")] TypeTest typeTest)
 {
     if (ModelState.IsValid)
     {
         db.Entry(typeTest).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(typeTest));
 }
Exemplo n.º 6
0
        public ActionResult Create([Bind(Include = "Id,Name")] TypeTest typeTest)
        {
            if (ModelState.IsValid)
            {
                db.TypeTests.Add(typeTest);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

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

            if (typeTest == null)
            {
                return(HttpNotFound());
            }
            return(View(typeTest));
        }
Exemplo n.º 8
0
 public override void PrintQuery(XmlWriter w)
 {
     w.WriteStartElement(this.GetType().Name);
     if (NameTest)
     {
         w.WriteAttributeString("name", Prefix.Length != 0 ? Prefix + ":" + Name : Name);
     }
     if (TypeTest != XPathNodeType.Element)
     {
         w.WriteAttributeString("nodeType", TypeTest.ToString());
     }
     qyInput.PrintQuery(w);
     w.WriteEndElement();
 }
Exemplo n.º 9
0
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            _timerAfterAnswers.Interval = 1500;
            _timerAfterAnswers.Tick    += TimerWrongAnswers_Tick;

            bool isCorrectResult;

            try
            {
                isCorrectResult = IsCorrectResultOfTest();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            if (isCorrectResult)
            {
                ShowSuccessMessage();

                _answerService.AddAnswer(new Answer(_wordToTranslate.Id, Answer.Type.Right));
                _testService.SetWordIsLearned(_typeTest, _wordToTranslate.Id);

                if (_typeTest != TypeTest.RussianTranslation)
                {
                    _typeTest++;
                }
                else
                {
                    _typeTest = TypeTest.EnglishCheck;
                }

                _timerAfterAnswers.Start();
            }
            else
            {
                if (_wrongAnswersCount < 3)
                {
                    ShowErrorBecauseOfWrongAnswer();

                    if (++_wrongAnswersCount == 3)
                    {
                        ShowEndTestBecauseOfWrongAnswers();
                    }
                }
            }

            ClearFormAfterTest();
        }
Exemplo n.º 10
0
            public void HandleType()
            {
                TypeTest            target   = new TypeTest();
                Snapshot <TypeTest> snapshot = new Snapshot <TypeTest>(target);
                TypeTest            x        = snapshot.Deserialize();
                string serialized            = snapshot.Serialize();

                string[]            split        = serialized.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                Snapshot <TypeTest> deserialized = Snapshot <TypeTest> .FromString(serialized);

                TypeTest y = deserialized.Deserialize();

                Assert.AreEqual(typeof(string), y.typeVal);
            }
Exemplo n.º 11
0
        public void TestTypeTest()
        {
            TypeTest tt = new TypeTest();

            tt.Name  = "TypeTester";
            tt.Bytes = Encoding.UTF8.GetBytes(tt.Name);
            tt.Save();

            var dbtt = MongoEntity.Get <TypeTest>(tt.Id);

            string b64 = Convert.ToBase64String(tt.Bytes);

            Assert.AreEqual(tt.Name, dbtt.Name);
            Assert.AreEqual(tt.Bytes.Length, dbtt.Bytes.Length);
            Assert.AreEqual(tt.Bytes, dbtt.Bytes);
        }
Exemplo n.º 12
0
        public static string Ajouter(string _nom, string _com)
        {
            TypeTest typeTest = new TypeTest();
            typeTest.nomTest = _nom;
            typeTest.descTest = _com;

            try
            {
                context.tblTypeTest.Add(typeTest);
                context.SaveChanges();
                return "Le type test a été créé";
            }
            catch (Exception)
            {
                return "Une erreur est survenue lors de l'ajout du Type de test. Les données n'ont pas été enregistrées.";
            }
        }
Exemplo n.º 13
0
Arquivo: 2.cs Projeto: vikchopde/study
        static void Main(string[] args)
        {
            var name        = "Bugs Bunny";
            var age         = 25;
            var isMature    = false;
            var typeTestObj = new TypeTest();
            int i           = 32;

            Type nameType        = name.GetType();
            Type ageType         = age.GetType();
            Type matureType      = isMature.GetType();
            Type typeTestObjType = typeTestObj.GetType();
            Type iType           = i.GetType();

            Console.WriteLine("name is of type " + nameType.ToString());
            Console.WriteLine("age is of type " + ageType.ToString());
            Console.WriteLine("isMature is of type " + matureType.ToString());
            Console.WriteLine("typeTestObj is of type " + typeTestObjType.ToString());
            Console.WriteLine("i is of type " + iType.ToString());
            Console.WriteLine(iType);

            return;
        }
Exemplo n.º 14
0
        // on change la value dans le dictionnaire pour la déplacer dans l'autre list
        public static Dictionary<TypeTest, int> ModifierLstBox(TypeTest _tT,bool _option)
        {
            // si option est true sa veut dire qu'on veut ajouter à l'employé
            if (_option)
            {
                lstTypeTestLstBox[_tT] = 1;
            }
            else
            {
                lstTypeTestLstBox[_tT] = 0;
            }

            return lstTypeTestLstBox;
        }
Exemplo n.º 15
0
Arquivo: Program.cs Projeto: gaea/BMS
        public static void Test(TypeTest type)
        {
            switch (type)
            {
                case TypeTest.Diary:
                    {
                        Diary diary = DiariesDao.find(1);

                        List<Diary> diaries = DiariesDao.findBy("Id_Visitor", "11");

                        List<Visit> visits = VisitsDao.findBy("Id_Visitor", 11);

                        if (diary == null)
                        {
                            diary = new TMA.MODEL.Entity.Diary()
                            {
                                DateDiary = "0",
                                HourDiary = "0",
                                DateCreateRegistration = DateTime.Now.ToLocalTime(),
                                DateModifyRegistration = DateTime.Now.ToLocalTime(),
                                CenterCost = 1

                            };

                            TMA.DAO.EntityManager.DiariesDao.save(diary);
                        }

                        break;
                    }
                case TypeTest.Person:
                    {
                        Person person = PersonsDao.find(2);

                        if (person == null)
                        {
                            person = new TMA.MODEL.Entity.Person()
                            {
                                Id_BiometricReader = 500003,
                                Name = "Agustín",
                                LastName = "Mejía",
                                DateCreateRegistration = DateTime.Now,

                            };

                            TMA.DAO.EntityManager.PersonsDao.save(person);
                        }
                        else {
                            person.DateModifyRegistration = DateTime.Now;
                            TMA.DAO.EntityManager.PersonsDao.update(person);
                        }

                        break;
                    }

                case TypeTest.Visit:
                    {
                        Visit visit = VisitsDao.find(8);

                        VisitsDao.findFunctionaryBy("Name", "wil");

                        if (visit == null)
                        {
                            visit = new TMA.MODEL.Entity.Visit()
                            {
                                Id_Visit = 0,
                                Id_Visitor = 1,
                                Id_Functionary = 1,
                                VisitDescription = "Capacitación",
                                ElementsToGetIn = "Pc",
                                DateCreateTransaction = DateTime.Now,
                                DateCreateRegistration = DateTime.Now,
                                DateModifyRegistration = DateTime.Now,
                                FinalDate = DateTime.Now,
                                FinalHour = DateTime.Now,
                                InitialDate = DateTime.Now,
                                InitialHour = DateTime.Now,
                                Id_UserCreateRegistration = "1",
                                Id_UserModifyRegistration = "1",
                                Id_Area = 1
                            };

                            TMA.DAO.EntityManager.VisitsDao.save(visit);
                        }

                        break;
                    }

                case TypeTest.User:
                    {
                        Users user = TMA.DAO.EntityManager.UsersDao.find(2);

                        if (user == null)
                        {
                            user = new TMA.MODEL.Entity.Users()
                            {
                                Id_User = 2,
                                IsActive = true,
                                Id_Role = 1,
                                DocumentType = 1,
                                DateCreateRegistration = System.DateTime.Now,
                                DateModifyRegistration = System.DateTime.Now,
                                Name = "Agus",
                                Login = "******"
                            };

                            TMA.DAO.EntityManager.UsersDao.save(user);
                        }
                        break;
                    }
                case TypeTest.Profile: {

                    Profile profile = ProfilesDao.find(8);

                    if (profile == null)
                    {
                        profile = new TMA.MODEL.Entity.Profile() { Id_Profile = 4, Description = "Administrador", DateCreateRegistration = DateTime.Now, Id_User = 1, DateModifyRegistration = DateTime.Now, Id_UserModifyRegistration = 1 };
                        TMA.DAO.EntityManager.ProfilesDao.save(profile);
                    }

                    break;
                }

                case TypeTest.Headquarter:
                    {
                        Headquarter head = HeadquartersDao.find(1);

                        if (head == null)
                        {
                            head = new TMA.MODEL.Entity.Headquarter() { Id_Headquarter = 3, Description = "Este" };
                            TMA.DAO.EntityManager.HeadquartersDao.save(head);
                        }

                        break;
                    }

                case TypeTest.Department:
                    {
                        Department department = DepartmentsDao.find(1);

                        if (department == null)
                        {
                            department = new TMA.MODEL.Entity.Department() { Name = "Valle" };
                            TMA.DAO.EntityManager.DepartmentsDao.save(department);
                        }

                        break;
                    }

                case TypeTest.City:
                    {
                        City city = CitiesDao.find(1);

                        if (city == null)
                        {
                            city = new TMA.MODEL.Entity.City() {  Name = "Cali", Id_Department = 1 };
                            TMA.DAO.EntityManager.CitiesDao.save(city);
                        }

                        break;
                    }

                case TypeTest.Depencency:
                    {
                        Dependency dependency = DependenciesDao.find(10);

                        if (dependency == null)
                        {
                            dependency = new Dependency()
                            {
                                Name = "Sistemas",
                                Id_Company = 1
                            };

                            DependenciesDao.save(dependency);
                        }

                        break;
                    }

                case TypeTest.CostCenter:
                    {
                        CostCenter cost = CostCentersDao.find(10);

                        if( cost == null)
                        {
                            cost = new CostCenter()
                            {
                                Id_Dependency =1,
                                Name = "Sistemas"
                            };

                            CostCentersDao.save(cost);
                        }

                        break;
                    }

                case TypeTest.Company:
                    {
                        Company company = CompaniesDao.find(10);

                        if (company == null)
                        {
                            company = new Company()
                            {
                                Name = "Carvajal Servicios",
                                Address = "Calle 1234",
                                Id_City = 1,
                                Id_Subsidiary = 1
                            };

                            CompaniesDao.save(company);
                        }

                        break;
                    }
            }
        }
Exemplo n.º 16
0
 static int Main()
 {
     TypeTest tt = new TypeTest();
     tt.Run();
     return 0;
 }
Exemplo n.º 17
0
        public List <Word> GetWordsForTesting(TypeTest typeTest)
        {
            var wordsInUsedCategories = _localData.Categories.Where(x => x.IsUsed).SelectMany(x => _localData.Words.Where(w => w.CategoryId == x.CategoryId)).ToList();

            if (wordsInUsedCategories.Count < Settings.MinAllowedWordsForTest)
            {
                throw new Exception("There are less then 5 words in selected categories. Please add more words or use more categories");
            }

            var requiredWords = new List <Word>();

            while (requiredWords.Count < Settings.MinAllowedWordsForTest)
            {
                requiredWords = new List <Word>(wordsInUsedCategories);
                switch (typeTest)
                {
                case TypeTest.EnglishCheck:
                    requiredWords.RemoveAll(x => x.IsLearnedEnglishByCheck);
                    break;

                case TypeTest.EnglishTranslation:
                    requiredWords.RemoveAll(x => x.IsLearnedEnglishByTranslation);
                    break;

                case TypeTest.RussianCheck:
                    requiredWords.RemoveAll(x => x.IsLearnedRussianByCheck);
                    break;

                case TypeTest.RussianTranslation:
                    requiredWords.RemoveAll(x => x.IsLearnedRussianByTranslation);
                    break;
                }

                if (requiredWords.Count() < Settings.MinAllowedWordsForTest)
                {
                    switch (typeTest)
                    {
                    case TypeTest.EnglishCheck:
                        _wordRepository.ResetAllEnglishLearnedWordsByChecking();
                        break;

                    case TypeTest.EnglishTranslation:
                        _wordRepository.ResetAllEnglishLearnedWordsByTranslation();
                        break;

                    case TypeTest.RussianCheck:
                        _wordRepository.ResetAllRussianLearnedWordsByChecking();
                        break;

                    case TypeTest.RussianTranslation:
                        _wordRepository.ResetAllRussianLearnedWordsByTranslation();
                        break;
                    }

                    var allWords = _wordRepository.GetAllWords().ToList();

                    LocalAppData.Instance.Words = allWords;
                    wordsInUsedCategories       = allWords;
                }
            }

            foreach (var word in requiredWords)
            {
                word.Translate = word.GetRandomTranslate;
            }

            requiredWords = requiredWords.Take(10).ToList().Shuffle().Take(Settings.MinAllowedWordsForTest).ToList();

            return(requiredWords);
        }