Esempio n. 1
0
        public void SeededReview_DeleteById_Deleted()
        {
            _reviewRepositorySUT.Delete(Seed.Review1.Id);

            using var dbxAssert = _dbContextFactory.CreateDbContext();
            Assert.False(dbxAssert.Reviews.Any(i => i.Id == Seed.Review1.Id));
        }
Esempio n. 2
0
        public void SeededPerson_DeleteById_Deleted()
        {
            _personRepositorySUT.Delete(Seed.JohnTravolta.Id);
            using var dbxAssert = _dbContextFactory.CreateDbContext();

            Assert.False(dbxAssert.Persons.Any(i => i.Id == Seed.JohnTravolta.Id));
        }
Esempio n. 3
0
 public PersonRepositoryTests()
 {
     _dbContextFactory = new DbContextInMemoryFactory(nameof(PersonRepositoryTests));
     using var dbx     = _dbContextFactory.CreateDbContext();
     dbx.Database.EnsureCreated();
     _personRepositorySUT = new PersonRepository(_dbContextFactory);
 }
Esempio n. 4
0
    protected DbContextTestsBase(ITestOutputHelper output)
    {
        XUnitTestOutputConverter converter = new(output);

        Console.SetOut(converter);

        DbContextFactory = new DbContextInMemoryFactory(GetType().Name, seedTestingData: true);
        // DbContextFactory = new DbContextLocalDBTestingFactory(GetType().FullName!, seedTestingData: true);

        CookBookDbContextSUT = DbContextFactory.CreateDbContext();
    }
Esempio n. 5
0
        public void AddNew_Film_Persisted()
        {
            var film = new FilmEntity()
            {
                OriginalName = "Lord of the Rings",
                Country      = "USA",
                CzechName    = "Pan Prstenu",
                Description  = "Something",
                Genre        = GenreEnum.Fantasy,
                TitleFotoUrl = "path"
            };

            _filmDatDbContext.Films.Add((film));
            _filmDatDbContext.SaveChanges();

            using var dbx = _dbContextFactory.CreateDbContext();

            var fromDb = dbx.Films
                         .Single(i => i.Id == film.Id);

            Assert.Equal(film, fromDb, FilmEntity.FilmAloneComparer);
        }
Esempio n. 6
0
 public void SeedFilm_DeleteByID_Deleted()
 {
     _filmRepositorySUT.Delete(Seed.GreaseFilm.Id);
     using var dbxAssert = _dbContextFactory.CreateDbContext();
     Assert.False(dbxAssert.Films.Any(i => i.Id == Seed.GreaseFilm.Id));
 }
Esempio n. 7
0
 public FilmDatDbContextTests()
 {
     _dbContextFactory = new DbContextInMemoryFactory(nameof(FilmDatDbContext));
     _filmDatDbContext = _dbContextFactory.CreateDbContext();
     _filmDatDbContext.Database.EnsureCreated();
 }