예제 #1
0
        public void DeleteFlashcardTestA()
        {
            ResetTestDatabasev4.Reset();

            DeleteFlashcard _processor = new DeleteFlashcard();

            _processor.Delete(Guid.Parse("f34b0017-65e3-4f37-8d1b-4ab096f64046"));

            List <FlashcardDbModel> flashcardsAfterDelete;

            using (var db = new FlashcardsDbContext())
            {
                flashcardsAfterDelete = db.FlashcardsDbModels.ToList();
            }

            Assert.Null(flashcardsAfterDelete.FirstOrDefault(e => e.Id == Guid.Parse("f34b0017-65e3-4f37-8d1b-4ab096f64046")));
        }
        public void UpdateFlashcardWordsTestA()
        {
            ResetTestDatabasev4.Reset();

            UpdateFlashcardWords _processor = new UpdateFlashcardWords();

            _processor.Update(Guid.Parse("073e83a0-57ff-43b8-a2c7-56a54b5ab22c"), "native123", "foreign123");

            List <FlashcardDbModel> flashcardsAfterUpdate;

            using (var db = new FlashcardsDbContext())
            {
                flashcardsAfterUpdate = db.FlashcardsDbModels.Where(e => e.Id == Guid.Parse("073e83a0-57ff-43b8-a2c7-56a54b5ab22c")).ToList();
            }

            Assert.True(flashcardsAfterUpdate.Count == 2);

            foreach (var item in flashcardsAfterUpdate)
            {
                Assert.Equal("foreign123", item.ForeignLanguage);
                Assert.Equal("native123", item.NativeLanguage);
            }
        }