Ejemplo n.º 1
0
        public void CreateFlashcardTestB()
        {
            ResetTestDatabasev2.Reset();

            ICreateFlashcard _processor = new CreateFlashcard(new CheckIfFlashcardIdIsUnique(), new CheckIfFlashcardIsUnique(), new InsertNewFlashcard(), new ValidateFlashcard());

            Assert.False(_processor.Create("Flashcard 1 Native", "Flashcard 1 Foreign", Guid.Parse("f34b0017-65e3-4f37-8d1b-4ab096f64046")));
            Assert.NotEmpty(_processor.GetUserMessages());
            Assert.Contains("Flashcard already exists.", _processor.GetUserMessages());
        }
Ejemplo n.º 2
0
        public void CreateFlashcardTestC()
        {
            ResetTestDatabasev2.Reset();

            ICreateFlashcard _processor = new CreateFlashcard(new CheckIfFlashcardIdIsUnique(), new CheckIfFlashcardIsUnique(), new InsertNewFlashcard(), new ValidateFlashcard());

            Assert.True(_processor.Create("Flashcard 1 Native", "Flashcard 1 Foreign", Guid.Parse("1d917073-68ea-4e11-b4ae-816f30e33e72")));
            Assert.Empty(_processor.GetUserMessages());

            using (var db = new FlashcardsDbContext())
            {
                Assert.NotNull(db.FlashcardsDbModels.FirstOrDefault(e => e.NativeLanguage == "Flashcard 1 Native" && e.ForeignLanguage == "Flashcard 1 Foreign" && e.GroupDbModelId == Guid.Parse("1d917073-68ea-4e11-b4ae-816f30e33e72")));
            }
        }
Ejemplo n.º 3
0
        public void CreateFlashcardTestA()
        {
            ResetTestDatabasev2.Reset();

            ICreateFlashcard _processor = new CreateFlashcard(new CheckIfFlashcardIdIsUnique(), new CheckIfFlashcardIsUnique(), new InsertNewFlashcard(), new ValidateFlashcard());

            Assert.True(_processor.Create("XYZ", "XYZ", Guid.Parse("f34b0017-65e3-4f37-8d1b-4ab096f64046")));
            Assert.Empty(_processor.GetUserMessages());

            using (var db = new FlashcardsDbContext())
            {
                Assert.NotNull(db.FlashcardsDbModels.FirstOrDefault(e => e.NativeLanguage == "XYZ" && e.ForeignLanguage == "XYZ" && e.GroupDbModelId == Guid.Parse("f34b0017-65e3-4f37-8d1b-4ab096f64046")));
            }
        }