Beispiel #1
0
        public static void SeedDatabaseSubscriberToTwoArtists(this NewAlbumsDbContext context)
        {
            var artists = CreateTwoArtists();

            context.Artists.AddRange(artists);

            var subscriber = CreateSubscriber();

            context.Subscribers.Add(subscriber);

            CreateSubscriptions(subscriber, artists);

            context.SaveChanges();
        }
Beispiel #2
0
        public BaseTest()
        {
            var options = SqliteInMemory.CreateOptions <NewAlbumsDbContext>();

            DbContext = new NewAlbumsDbContext(options);
            DbContext.Database.EnsureCreated();

            var utData = DbContext.SetupSingleDtoAndEntities <SubscriberDto>();

            utData.AddSingleDto <ArtistDto>();
            utData.AddSingleDto <AlbumDto>();
            utData.AddSingleDto <SubscriptionDto>();

            CrudServicesAsync = new CrudServicesAsync(DbContext, utData.ConfigAndMapper);
        }