Example #1
0
        public async Task AddOne_GetReturnsIt()
        {
            var example = CreateExample("table", "стол");
            await _repo.Add(example);

            var read = await _repo.GetOrDefault(example.Id);

            Assert.AreEqual(example.OriginPhrase, read.OriginPhrase);
            Assert.AreEqual(example.OriginWord, read.OriginWord);
            Assert.AreEqual(example.TranslatedPhrase, read.TranslatedPhrase);
            Assert.AreEqual(example.TranslatedWord, read.TranslatedWord);
        }
Example #2
0
        public async Task AddNewWord(DictionaryWord word)
        {
            var allExamples = word.Translations
                              .SelectMany(t => t.Examples)
                              .Select(e => e.ExampleOrNull)
                              .Where(e => e != null);
            await _exampleRepository.Add(allExamples);

            await _dicRepository.Add(word);
        }