コード例 #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());
        }
コード例 #2
0
 public ProfileController(OrderFoodContext ctx, IMapper mapper)
 {
     _ctx    = ctx;
     _mapper = mapper;
 }
コード例 #3
0
 public SigninController(OrderFoodContext db, IMapper mapper)
 {
     _ctx = db; _mapper = mapper;
 }
コード例 #4
0
 public EmployeeController(OrderFoodContext ctx, IMapper mapper)
 {
     _ctx    = ctx;
     _mapper = mapper;
 }
コード例 #5
0
 public RestaurantRepository(OrderFoodContext context)
 {
     this._context = context ?? throw new ArgumentNullException(nameof(context));
 }
コード例 #6
0
 public ProductController(OrderFoodContext orderFoodContext, IMapper mapper)
 {
     _ctx    = orderFoodContext;
     _mapper = mapper;
 }
コード例 #7
0
 public ShopLeft(OrderFoodContext ctx, IMapper mapper)
 {
     _ctx    = ctx;
     _mapper = mapper;
 }