Example #1
0
        public void TestUpdateManyWords()
        {
            //arrange
            LocalWordDB sut = new LocalWordDB();

            sut.CreateDatabase();

            List <DbWord> wordlist = new List <DbWord>
            {
                defaultDbWord,
                defaultDbWord2
            };

            sut.TryAddWord(defaultDbWord.Word, defaultDbWord.SynsetId).Should().BeTrue();
            sut.TryAddWord(defaultDbWord2.Word, defaultDbWord2.SynsetId).Should().BeTrue();

            var updatedSynset = "b:04704254";

            List <DbWord> wordlist2 = new List <DbWord>
            {
                new DbWord {
                    Word = "test", SynsetId = updatedSynset, CreationDate = DateTime.Today
                }
            };

            //act
            sut.TryUpdateDbWords(wordlist2).Should().Be(1);

            //assert

            sut.TryGetWords(wordlist, out IEnumerable <DbWord> outDbWords).Should().BeTrue();

            outDbWords.Count().Should().Be(wordlist.Count);

            outDbWords.ToList().Where(x => x.Word == "test").First().SynsetId.Should().Be(updatedSynset);


            //restore
            sut.DeleteDatabase();
        }