Пример #1
0
        public void TestMultipleWordInsertion(int count)
        {
            //arrange
            LocalWordDB sut = new LocalWordDB();

            sut.CreateDatabase();
            List <DbWord> wordlist = new List <DbWord>();

            for (int i = 0; i < count; i++)
            {
                wordlist.Add(new DbWord {
                    Word         = Guid.NewGuid().ToString(),
                    SynsetId     = Guid.NewGuid().ToString(),
                    CreationDate = DateTime.Today
                });
            }

            //act-assert
            sut.TryAddWords(wordlist).Should().Be(count);

            int countCheck = 0;

            foreach (DbWord word in wordlist)
            {
                sut.TryGetWord(word.Word, out DbWord wordOut).Should().BeTrue();
                countCheck++;
            }

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

            //restore
            sut.DeleteDatabase();
        }
Пример #2
0
        public void TestSelectWordFromWord()
        {
            //arrange
            LocalWordDB sut = new LocalWordDB();

            sut.CreateDatabase();
            //act-assert
            sut.TryGetWord(defaultDbWord.Word, out DbWord data).Should().BeFalse();

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

            sut.TryGetWord(defaultDbWord.Word, out DbWord data2).Should().BeTrue();

            data2.Should().Be(defaultDbWord);


            //restore
            sut.DeleteDatabase();
        }