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); } }
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); }
public void DeleteTheme() { IThemeGateway themeGateway = Gateway.ThemeGateway; themeGateway.DeleteAllThemes(); Theme theme = new Theme(0, "Animals"); int id = themeGateway.AddTheme(theme); themeGateway.DeleteTheme(id); List <Theme> themeList = themeGateway.GetThemesList(); Assert.AreEqual(0, themeList.Count); }
public void AddTheme() { IThemeGateway themeGateway = Gateway.ThemeGateway; themeGateway.DeleteAllThemes(); Theme theme = new Theme(0, "Animals"); int id = themeGateway.AddTheme(theme); List <Theme> themeList = themeGateway.GetThemesList(); Assert.AreEqual(1, themeList.Count); Theme theme1 = themeList[0]; Assert.AreEqual(id, theme1.ID); Assert.AreEqual(theme.Name, theme1.Name); }
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); }
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); }