예제 #1
0
        public void Test_GetStoreToppings()
        {
            var options = new DbContextOptionsBuilder <StoreContext>()
                          .UseInMemoryDatabase(databaseName: "TestDb15")
                          .Options;

            using (var context = new StoreContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                StoreRepository storeRepo = new StoreRepository(context);
                StoreLogic      sl        = new StoreLogic(storeRepo);

                AStore store1 = new AStore();
                store1.Name = "Store1";
                ItemType        type        = new ItemType("testtype");
                APizzaComponent comp        = new APizzaComponent("testcomp", type);
                Topping         testtopping = new Topping(store1, 0, 0, comp);

                context.Add <AStore>(store1);
                context.Add <Topping>(testtopping);
                context.SaveChanges();

                List <Topping> toppings = sl.GetStoreToppings(store1.StoreID);

                Assert.Equal(testtopping.PizzaType.Name, toppings[0].PizzaType.Name);
            }
        }
예제 #2
0
        public List <Topping> StoreToppings([FromBody] Guid id)
        {
            List <Topping> toppings = storeLogic.GetStoreToppings(id);

            return(toppings);
        }