示例#1
0
        public void StuffStartsHere()
        {
            _context = new DevLunchDbContext(Effort.DbConnectionFactory.CreateTransient());

            _controller = new LunchesController(_context);
            _controller.WithAuthenticatedUser("Brent", "ImBrent");

            _lunch = new Lunch()
            {
                Host        = "Brent",
                MeetingTime = new DateTime(1985, 6, 6),
                Restaurants = new List <Restaurant>()
                {
                    new Restaurant {
                        Name = "Linda's", Latitude = 55, Longitude = 60
                    },
                    new Restaurant {
                        Name = "The Pine Box", Latitude = 55, Longitude = 60
                    },
                    new Restaurant {
                        Name = "Sizzler", Latitude = 55, Longitude = 60
                    }
                }
            };

            _context.Lunches.Add(_lunch);
            _context.SaveChanges();

            _lunchId       = _lunch.Id;
            _restaurantId1 = _lunch.Restaurants.First().Id;
            _restaurantId2 = _lunch.Restaurants.FirstOrDefault(r => r.Name == "The Pine Box").Id;
            _restaurantId3 = _lunch.Restaurants.Last().Id;
        }