Exemple #1
0
        public KosarServiceTest()
        {
            options = new DbContextOptionsBuilder <R0ga3cContext>()
                      .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                      .Options;

            using (var context = new R0ga3cContext(options))
            {
                var vevo = new Vevo {
                    Id = 1, Nev = "Ede"
                };
                var kosar = new Kosar {
                    Id = 1, Vevo = vevo
                };
                var status = new Statusz {
                    Id = 1, Nev = "Dolgozunk"
                };
                kosar.Statusz = status;
                vevo.Kosar    = new List <Kosar> {
                    kosar
                };

                context.Kosar.Add(kosar);
                context.Vevo.Add(vevo);
                context.Statusz.Add(status);

                context.SaveChanges();
            }

            _service = new KosarService(new R0ga3cContext(options));
        }
Exemple #2
0
        public CategoryServiceTest()
        {
            options = new DbContextOptionsBuilder <R0ga3cContext>()
                      .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                      .Options;

            using (var context = new R0ga3cContext(options))
            {
                var vevo = new Vevo {
                    Id = 1, Nev = "Ede"
                };
                var kosar = new Kosar {
                    Id = 1, Vevo = vevo
                };
                var status = new Statusz {
                    Id = 1, Nev = "Dolgozunk"
                };
                kosar.Statusz = status;
                vevo.Kosar    = new List <Kosar> {
                    kosar
                };

                var termek = new Termek {
                    Nev = "Autó", Id = 1
                };
                context.Termek.Add(termek);
                context.Kategoria.Add(new Kategoria {
                    Id = 1, Nev = "Jármű", Termek = new List <Termek> {
                        termek
                    }
                });

                context.Kosar.Add(kosar);
                context.Vevo.Add(vevo);
                context.Statusz.Add(status);

                context.SaveChanges();
            }

            _service = new KategoryService(new R0ga3cContext(options));
        }