public CommentRepositoryTests() { var options = new DbContextOptionsBuilder<EventProjectDbContext>() .UseInMemoryDatabase("TestDb").Options; db = new EventProjectDbContext(options); repository = new CommentRepository(db); }
public CommentEventRepository(EventProjectDbContext c) : base(c?.Comments, c) { db = c; eventDbSet = c?.CommentEvent; profileDbSet = c?.CommentProfile; commentDbSet = c?.Comments; }
public static void Initialize(EventProjectDbContext c) { c.Database.EnsureCreated(); //kas andmebaas on olemas if (c.Events.Any()) { return; //kui aadresside tabelis midagi, lõpetab tegevuse } c.SaveChanges(); }
private static void initProfiles(EventProjectDbContext c) { add(c, new ProfileDbRecord { Name = "Iris Nael", Location = "Tallinn", Gender = ProfileGender.Female }); }
private void initTestDatabase() { var scope = server.Host.Services.CreateScope(); var services = scope.ServiceProvider; db = services.GetService <TContext>(); eventProjectDbContext = services.GetService <EventProjectDbContext>(); initializeDatabase(db); }
private static void initEvents(EventProjectDbContext c) { add(c, new EventDbRecord { Name = "Parklapidu", Location = "Tallinn", Date = DateTime.Parse("12.12.2018"), //TODO control datetime date!!!! Type = EventType.Concert, Organizer = "TTU", Description = "bla bla bla" }); }
public CommentProfileRepository(EventProjectDbContext c) : base(c?.Comments, c) { db = c; dbSet = c?.CommentProfile; }
private static string add(EventProjectDbContext c, EventDbRecord events) //unikaalse ID genereerimine { events.ID = Guid.NewGuid().ToString(); c.Events.Add(events); //lisab andmebaasi return(events.ID); }
public EventObjectsRepository(EventProjectDbContext c) : base(c?.Events, c) { dbSet = c?.Events; }
public FollowingRepository(EventProjectDbContext c) : base(c?.Profiles, c) { db = c; dbSet = c?.Followings; profileDbSet = c?.Profiles; }
public ProfileObjectsRepository(EventProjectDbContext c) : base(c?.Profiles, c) { dbSet = c?.Profiles; }
private static string add(EventProjectDbContext c, ProfileDbRecord profile) //unikaalse ID genereerimine { profile.ID = Guid.NewGuid().ToString(); c.Profiles.Add(profile); //lisab andmebaasi return(profile.ID); }
public AttendingRepository(EventProjectDbContext c) : base(c?.Events, c) { db = c; dbSet = c?.EventsProfiles; eventDbSet = c?.Events; }