Beispiel #1
0
 private void AddEvents(Guru3Context context)
 {
     context.Events.Add(new Event
     {
         Id   = 1,
         Name = "34c3",
         RegistrationStart = new DateTime(2017, 12, 1),
         End      = new DateTime(2017, 12, 30),
         Location = "Leipzig"
     });
     context.Events.Add(new Event
     {
         Id   = 2,
         Name = "current",
         RegistrationStart = DateTime.Now.AddDays(-7),
         End      = DateTime.Now.AddDays(7),
         Location = "somewhere"
     });
     context.Events.Add(new Event
     {
         Id   = 3,
         Name = "ümläut",
         RegistrationStart = DateTime.Now.AddDays(-1),
         End      = DateTime.Now.AddDays(14),
         Location = "Düsseldorf"
     });
     context.Events.Add(new Event
     {
         Id   = 4,
         Name = "future",
         RegistrationStart = DateTime.Now.AddDays(7),
         End      = DateTime.Now.AddDays(14),
         Location = "moon"
     });
 }
Beispiel #2
0
 public Guru3Collection(string root, int id, string name, DateTimeOffset lastChanged, Guru3Context context)
     : this(root, name)
 {
     _context = context;
     _id      = id;
     _etag    = lastChanged.ToUnixTimeMilliseconds().ToString();
 }
Beispiel #3
0
 public Guru3Item(int id, string number, DateTimeOffset lastChanged, Guru3Context context)
 {
     _id      = id;
     _number  = number;
     _etag    = lastChanged.ToUnixTimeMilliseconds().ToString();
     _context = context;
 }
Beispiel #4
0
 public void CanConnect()
 {
     using (var context = new Guru3Context(_connectionString))
     {
         context.Database.ExecuteSqlRaw("SELECT NOW();");
     }
 }
Beispiel #5
0
        public async Task CanGetExtension()
        {
            using (var context = new Guru3Context(_connectionString))
            {
                var ext = await context.Extensions.Where(x => x.EventId == 66).FirstOrDefaultAsync(x => x.Name.Contains("ziv"));

                Assert.NotNull(ext);
                Assert.Equal(45348, ext.Id);
                Assert.Equal("zivillian", ext.Name);
                Assert.Equal("PoC", ext.Location);
                Assert.True(ext.InPhonebook);
                Assert.Equal("4502", ext.Number);
            }
        }
Beispiel #6
0
        public async Task CanGetEvent()
        {
            using (var context = new Guru3Context(_connectionString))
            {
                var froscon = await context.Events.FirstOrDefaultAsync(x => x.Id == 66);

                Assert.NotNull(froscon);
                Assert.Equal(66, froscon.Id);
                Assert.Equal("FrOSCon 2018", froscon.Name);
                Assert.Equal("FH Sankt Augustin", froscon.Location);
                Assert.Equal(new DateTime(2018, 06, 01), froscon.RegistrationStart);
                Assert.Equal(new DateTime(2018, 08, 26), froscon.End);
                Assert.Equal("de", froscon.DescriptionDe);
            }
        }
Beispiel #7
0
        protected TestLdapServer GetServer(string name)
        {
            var serviceProvider = new ServiceCollection()
                                  .AddEntityFrameworkInMemoryDatabase()
                                  .BuildServiceProvider();

            var options = new DbContextOptionsBuilder <Guru3Context>()
                          .UseInMemoryDatabase(databaseName: name)
                          .UseInternalServiceProvider(serviceProvider)
                          .Options;

            using (var context = new Guru3Context(options))
            {
                AddEvents(context);
                AddExtensions(context);
                context.SaveChanges();
            }
            return(new TestLdapServer(options));
        }
Beispiel #8
0
 public Guru3Store(Guru3Context context)
 {
     _context = context;
 }
 public Guru3RootCollection(string root, Guru3Context context)
     : base(root, "eventphone")
 {
     _context = context;
 }
Beispiel #10
0
        private void AddExtensions(Guru3Context context)
        {
            context.Extensions.Add(new Extension
            {
                Id          = 1,
                EventId     = 1,
                InPhonebook = true,
                Location    = "PoC",
                Name        = "zivillian 34c3",
                Number      = "4502"
            });
            context.Extensions.Add(new Extension
            {
                Id          = 2,
                EventId     = 2,
                InPhonebook = true,
                Location    = "PoC",
                Name        = "zivillian current",
                Number      = "4502"
            });
            context.Extensions.Add(new Extension
            {
                Id          = 3,
                EventId     = 3,
                InPhonebook = true,
                Location    = "PoC",
                Name        = "zivilliän",
                Number      = "4502"
            });
            context.Extensions.Add(new Extension
            {
                Id          = 4,
                EventId     = 4,
                InPhonebook = true,
                Location    = "PoC",
                Name        = "zivillian future",
                Number      = "4502"
            });

            context.Extensions.Add(new Extension
            {
                Id          = 5,
                EventId     = 1,
                InPhonebook = true,
                Location    = "PoC",
                Name        = "POC Hotline",
                Number      = "2000"
            });
            context.Extensions.Add(new Extension
            {
                Id          = 6,
                EventId     = 2,
                InPhonebook = true,
                Location    = "PoC",
                Name        = "POC Hotline",
                Number      = "2000"
            });
            context.Extensions.Add(new Extension
            {
                Id          = 7,
                EventId     = 3,
                InPhonebook = true,
                Location    = "PoC",
                Name        = "POC Hotline",
                Number      = "2000"
            });
            context.Extensions.Add(new Extension
            {
                Id          = 8,
                EventId     = 4,
                InPhonebook = true,
                Location    = "PoC",
                Name        = "POC Hotline",
                Number      = "2000"
            });

            context.Extensions.Add(new Extension
            {
                Id          = 9,
                EventId     = 1,
                InPhonebook = true,
                Location    = "CERT",
                Name        = "CERT",
                Number      = "112"
            });
            context.Extensions.Add(new Extension
            {
                Id          = 10,
                EventId     = 2,
                InPhonebook = true,
                Location    = "CERT",
                Name        = "CERT",
                Number      = "112"
            });
            context.Extensions.Add(new Extension
            {
                Id          = 11,
                EventId     = 3,
                InPhonebook = true,
                Location    = "CERT",
                Name        = "CÄRT",
                Number      = "112"
            });
            context.Extensions.Add(new Extension
            {
                Id          = 12,
                EventId     = 4,
                InPhonebook = true,
                Location    = "CERT",
                Name        = "CERT",
                Number      = "112"
            });

            context.Extensions.Add(new Extension
            {
                Id          = 13,
                EventId     = 2,
                InPhonebook = true,
                Location    = "",
                Name        = "Foo",
                Number      = "4444"
            });
        }