예제 #1
0
        public void SetUp()
        {
            var database = new Mock <IDatabase>();

            database.Setup(x => x.Query <ToppingRecord>()).Throws <Exception>();

            var subject = new ToppingRepository(database.Object);

            _result = subject.GetAll();
        }
예제 #2
0
        public PizzaViewModel(PizzaStoreDBContext dbo)
        {
            var cRepo = new CrustRepository(dbo);

            Crusts = cRepo.GetAll();
            var sRepo = new SizeRepository(dbo);

            Sizes = sRepo.GetAll();
            var tRepo = new ToppingRepository(dbo);

            Toppings  = new List <ToppingsModel>();
            Toppings2 = new List <CheckBoxTopping>();
            foreach (ToppingsModel t in tRepo.GetAll())
            {
                Toppings.Add(t);
            }
            foreach (var t in Toppings)
            {
                Toppings2.Add(new CheckBoxTopping()
                {
                    Name = t.Name, Id = t.Id, Description = t.Description, Text = t.Name, IsSelected = false
                });
            }
            var uRepo = new UserRepository(dbo);

            Users = uRepo.GetAll();
            var stRepo = new StoreRepository(dbo);

            Stores = stRepo.GetAll();
            var pRepo = new PizzaRepository(dbo);

            SpecialtyPizzas = pRepo.GetAllSpecialty();
            Pizzas          = new List <CheckBoxPizza>();
            GetCart(dbo);
            if (Cart.Pizzas != null)
            {
                foreach (PizzaModel p in Cart.Pizzas)
                {
                    Pizzas.Add(new CheckBoxPizza()
                    {
                        Name = p.Name, Id = p.Id, Description = p.Description, Text = p.Name, IsSelected = false
                    });
                }
            }
        }
        public void SetUp()
        {
            var database = new Mock <IDatabase>();

            database.Setup(x => x.Query <ToppingRecord>()).Returns(new List <ToppingRecord>
            {
                new ToppingRecord
                {
                    Id   = 1,
                    Name = "Onion"
                },
                new ToppingRecord
                {
                    Id   = 2,
                    Name = "Ham"
                }
            });

            var subject = new ToppingRepository(database.Object);

            _result = subject.GetAll();
        }