Exemplo n.º 1
0
 public CommentRepositoryTests()
 {
     var options = new DbContextOptionsBuilder<EventProjectDbContext>()
         .UseInMemoryDatabase("TestDb").Options;
     db = new EventProjectDbContext(options);
     repository = new CommentRepository(db);
 }
Exemplo n.º 2
0
 public CommentEventRepository(EventProjectDbContext c) : base(c?.Comments, c)
 {
     db           = c;
     eventDbSet   = c?.CommentEvent;
     profileDbSet = c?.CommentProfile;
     commentDbSet = c?.Comments;
 }
Exemplo n.º 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();
 }
Exemplo n.º 4
0
 private static void initProfiles(EventProjectDbContext c)
 {
     add(c, new ProfileDbRecord
     {
         Name     = "Iris Nael",
         Location = "Tallinn",
         Gender   = ProfileGender.Female
     });
 }
Exemplo n.º 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);
        }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 9
0
 public EventObjectsRepository(EventProjectDbContext c) : base(c?.Events, c)
 {
     dbSet = c?.Events;
 }
Exemplo n.º 10
0
 public FollowingRepository(EventProjectDbContext c) : base(c?.Profiles, c)
 {
     db           = c;
     dbSet        = c?.Followings;
     profileDbSet = c?.Profiles;
 }
Exemplo n.º 11
0
 public ProfileObjectsRepository(EventProjectDbContext c) : base(c?.Profiles, c)
 {
     dbSet = c?.Profiles;
 }
Exemplo n.º 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);
 }
Exemplo n.º 13
0
 public AttendingRepository(EventProjectDbContext c) : base(c?.Events, c)
 {
     db         = c;
     dbSet      = c?.EventsProfiles;
     eventDbSet = c?.Events;
 }