public void Init() { this.ConfigureMapper(); this.homes = new List <Home>() { new Home() { Id = 1, Name = "My home", Activities = "ironing, fishing, etc.", EndDate = DateTime.Now.AddDays(10), StartDate = DateTime.Now.AddDays(3), IsVisited = false, Notes = "There is a disco near it", Location = new Location() { Id = 1, Country = "UK", LocationName = "London", Latitude = -52.58m, Longitude = -1.97m }, PostedDate = DateTime.Now, ProfilePicture = "/Defaults/home.png", Provision = "Long table with rakia" }, new Home() { Id = 2, Name = "House on the Sunnybeach shore", Activities = "fishing, drinking, puking etc.", EndDate = DateTime.Now.AddDays(10), StartDate = DateTime.Now.AddDays(3), IsVisited = true, Notes = "There is a disco near it.", Location = new Location() { Id = 1, Country = "Bulgaria", LocationName = "Sunnybeach", Latitude = -52.58m, Longitude = -1.97m }, PostedDate = DateTime.Now, ProfilePicture = "/Defaults/home.png", Provision = "Long table with rakia" } }; this._context = new FakeSharenestDbContext(); this._repository = new FakeHomesRepository(this._context); this._service = new HomesService(this._repository); this._controller = new HomesController(this._service); foreach (var home in homes) { this._context.Homes.Add(home); } }
/// <summary> /// Homes db api /// </summary> /// <param name="mapper"></param> /// <param name="homesService"></param> public HomesController(IMapper mapper, IHomesService homesService) { _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); _homesService = homesService ?? throw new ArgumentNullException(nameof(homesService)); }
public HomesController(IHomesService service) { this.service = service; }