Ejemplo n.º 1
0
        public async void ShouldGetAllRestaurants()
        {
            var options = new DbContextOptionsBuilder <OrderFoodContext>().UseInMemoryDatabase(databaseName: "ShouldGetAllRestaurants").Options;

            var sortedList = new List <Restaurant>()
            {
                new Restaurant()
                {
                    Name = "Ramzes", Website = "www.ramzes.pl"
                },
                new Restaurant()
                {
                    Name = "Kebab Hot", Website = "www.kebabhot.pl"
                },
                new Restaurant()
                {
                    Name = "Muzyczna", Website = "www.muzyczna.pl"
                }
            };


            using (var context = new OrderFoodContext(options))
            {
                foreach (var game in sortedList)
                {
                    context.Add(game);
                    context.SaveChanges();
                }
            }

            // Act
            IEnumerable <Restaurant> actualList;

            using (var context = new OrderFoodContext(options))
            {
                var repository = new RestaurantRepository(context);
                actualList = await repository.GetAll();
            }

            // Assert
            Assert.Equal(sortedList.Count(), actualList.Count());
        }
Ejemplo n.º 2
0
 public ProfileController(OrderFoodContext ctx, IMapper mapper)
 {
     _ctx    = ctx;
     _mapper = mapper;
 }
Ejemplo n.º 3
0
 public SigninController(OrderFoodContext db, IMapper mapper)
 {
     _ctx = db; _mapper = mapper;
 }
 public EmployeeController(OrderFoodContext ctx, IMapper mapper)
 {
     _ctx    = ctx;
     _mapper = mapper;
 }
 public RestaurantRepository(OrderFoodContext context)
 {
     this._context = context ?? throw new ArgumentNullException(nameof(context));
 }
Ejemplo n.º 6
0
 public ProductController(OrderFoodContext orderFoodContext, IMapper mapper)
 {
     _ctx    = orderFoodContext;
     _mapper = mapper;
 }
Ejemplo n.º 7
0
 public ShopLeft(OrderFoodContext ctx, IMapper mapper)
 {
     _ctx    = ctx;
     _mapper = mapper;
 }