Example #1
0
 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;
 }
Example #3
0
 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();
 }
Example #4
0
 private static void initProfiles(EventProjectDbContext c)
 {
     add(c, new ProfileDbRecord
     {
         Name     = "Iris Nael",
         Location = "Tallinn",
         Gender   = ProfileGender.Female
     });
 }
Example #5
0
        private void initTestDatabase()
        {
            var scope    = server.Host.Services.CreateScope();
            var services = scope.ServiceProvider;

            db = services.GetService <TContext>();
            eventProjectDbContext = services.GetService <EventProjectDbContext>();
            initializeDatabase(db);
        }
Example #6
0
 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;
 }
Example #8
0
 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;
 }
Example #10
0
 public FollowingRepository(EventProjectDbContext c) : base(c?.Profiles, c)
 {
     db           = c;
     dbSet        = c?.Followings;
     profileDbSet = c?.Profiles;
 }
Example #11
0
 public ProfileObjectsRepository(EventProjectDbContext c) : base(c?.Profiles, c)
 {
     dbSet = c?.Profiles;
 }
Example #12
0
 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);
 }
Example #13
0
 public AttendingRepository(EventProjectDbContext c) : base(c?.Events, c)
 {
     db         = c;
     dbSet      = c?.EventsProfiles;
     eventDbSet = c?.Events;
 }