예제 #1
0
        public Test()
        {
            DbContextOptions <ApplicationDbContext> options;
            var builder = new DbContextOptionsBuilder <ApplicationDbContext>();

            builder.UseInMemoryDatabase();
            options = builder.Options;

            ApplicationDbContext _context = new ApplicationDbContext(options);

            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();
            _context.SaveChanges();

            _service = new TestService(_context);

            var user = new ApplicationUser {
                UserName = "******", Email = "*****@*****.**"
            };
            var cpu = new CPU
            {
                Name         = "i5-8400",
                Manufacturer = "Intel",
                Series       = "i5",
                Socket       = "1151",
                Cores        = "6",
                TDP          = "65",
                iGPU         = 1,
                Price        = "829"
            };

            var mobo = new MOBO
            {
                Name         = "Z370-A PRO",
                Manufacturer = "MSI",
                Standard     = "ATX",
                Chipset      = "Z370",
                Socket       = "1151",
                Ram_type     = "DDR4",
                Price        = "519"
            };

            var casePC =
                new Case
            {
                Name         = "BIG",
                Manufacturer = "Corsair",
                Price        = "500"
            };


            var psu = new PSU
            {
                Name         = "EVGA Supernnova G2",
                Manufacturer = "EVGA",
                Wattage      = "550",
                Price        = "329"
            };

            var ram = new RAM
            {
                Name         = "Corsair Vengeance LPX",
                Manufacturer = "Corsair",
                Ram_type     = "DDR4",
                Speed        = "3000",
                Price        = "619"
            };

            var cooler = new Cooler
            {
                Name   = "Noctua NH-D15",
                Socket = "1151",
                Fans   = "2",
                Price  = "400"
            };

            var gpu = new GPU
            {
                Name         = "MSI GTX 1070TI GAMING",
                Manufacturer = "MSI",
                Chipset      = "GTX 1070TI",
                TDP          = "200",
                Price        = "2100"
            };

            _service.AddConfiguration(cpu, gpu, mobo, ram, psu, casePC, cooler, user);

            list   = _service.GetPCs();
            pcdata = list.FirstOrDefault();
        }