Ejemplo n.º 1
0
        public void FillWithTwoThemesAndLexims()
        {
            IThemeGateway themeGateway = Gateway.ThemeGateway;

            themeGateway.DeleteAllThemes();
            Theme theme1 = new Theme(0, "AnimalsPart1");
            int   tid1   = themeGateway.AddTheme(theme1);
            Theme theme2 = new Theme(0, "AnimalsPart2");
            int   tid2   = themeGateway.AddTheme(theme2);

            ILexemGateway lexemGateway = Gateway.LexemGateway;

            for (int i = 0; i < 8; i++)
            {
                Lexeme lex = Lexemes.LexemeCollection[i];
                lex.ParentThemeID = tid1;
                lexemGateway.AddLexeme(lex);
            }
            for (int i = 7; i < 11; i++)
            {
                Lexeme lex = Lexemes.LexemeCollection[i];
                lex.ParentThemeID = tid2;
                lexemGateway.AddLexeme(lex);
            }
        }
Ejemplo n.º 2
0
        public void DeleteLexim()
        {
            IThemeGateway themeGateway = Gateway.ThemeGateway;

            themeGateway.DeleteAllThemes();
            Theme theme = new Theme(0, "Animals");
            int   id    = themeGateway.AddTheme(theme);

            ILexemGateway lexemGateway = Gateway.LexemGateway;
            Lexeme        lex          = Lexemes.LexemeCollection[0];

            lex.ParentThemeID = id;
            lex.ID            = lexemGateway.AddLexeme(lex);

            lexemGateway.DeleteLexeme(lex.ID);
            Dictionary <int, Lexeme> dic = lexemGateway.GetLexemes(id);

            Assert.AreEqual(0, dic.Count);

            string message = "";

            try
            {
                lexemGateway.GetLexeme(lex.ID);
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            Assert.AreEqual("There is no word with provided id", message);
        }
Ejemplo n.º 3
0
        public void UpdateLexim()
        {
            IThemeGateway themeGateway = Gateway.ThemeGateway;

            themeGateway.DeleteAllThemes();
            Theme theme = new Theme(0, "Animals");
            int   id    = themeGateway.AddTheme(theme);

            ILexemGateway lexemGateway = Gateway.LexemGateway;
            Lexeme        lex          = Lexemes.LexemeCollection[0];

            lex.ParentThemeID = id;
            lex.ID            = lexemGateway.AddLexeme(lex);

            lex.Word = "Fossil";
            lexemGateway.UpdateLexeme(lex);

            Lexeme lex1 = lexemGateway.GetLexeme(lex.ID);

            Assert.AreEqual("Fossil", lex1.Word);
            Assert.AreEqual(lex.ID, lex1.ID);
        }
Ejemplo n.º 4
0
        void DisplayLexims(int themeID)
        {
            Lexemes.Clear();
            System.GC.Collect();
            ILexemGateway lexemGateway = Gateway.LexemGateway;

            Lexemes.LexemeDictionary = lexemGateway.GetLexemes(themeID);
            this.ThemeView.LeximListBox.ClearAllItems();
            foreach (Lexeme lex in Lexemes.LexemeCollection)
            {
                LeximDTView ldt = new LeximDTView(lex.ID, lex.ParentThemeID, lex.Word, lex.Picture, lex.Sound);
                this.ThemeView.LeximListBox.AddDisplayLexim(ldt, this.ThemeView.Play);
            }
            if (Lexemes.LexemeCollection.Count > 0)
            {
                this.ThemeView.LeximListBox.SetSelectionAt(0);
            }
            else
            {
                this.ThemeView.DisplayLexim(new LeximDTView(0, themeID, string.Empty, null, null), this.ThemeView.Play);
            }
        }
Ejemplo n.º 5
0
        public void AddLexeme()
        {
            IThemeGateway themeGateway = Gateway.ThemeGateway;

            themeGateway.DeleteAllThemes();
            Theme theme = new Theme(0, "Animals");
            int   id    = themeGateway.AddTheme(theme);

            ILexemGateway lexemGateway = Gateway.LexemGateway;
            Lexeme        lex          = Lexemes.LexemeCollection[0];

            lex.ParentThemeID = id;
            lexemGateway.AddLexeme(lex);
            Lexeme lex1 = Lexemes.LexemeCollection[1];

            lex1.ParentThemeID = id;
            lex1.ID            = lexemGateway.AddLexeme(lex1);
            Dictionary <int, Lexeme> dic = lexemGateway.GetLexemes(id);

            Lexeme l = lexemGateway.GetLexeme(lex1.ID);

            Assert.AreEqual(2, dic.Count);
        }