public async Task Content_GET_WithDbContext_Async() { //Arrange var options = new DbContextOptionsBuilder <WanderListDbContext>() .UseInMemoryDatabase(databaseName: "WanderList") .Options; var logger = new Mock <ILogger <Content> >(); using var context = new WanderListDbContext(options); var content1 = new Content() { ContentId = Guid.NewGuid(), Address = "testing1", //Name = "tryme1" }; var content2 = new Content() { ContentId = Guid.NewGuid(), Address = "testing2", //Name = "tryme2" }; var content3 = new Content() { ContentId = Guid.NewGuid(), Address = "testing3", //Name = "tryme3" }; context.Add(content1); context.Add(content2); context.Add(content3); context.SaveChanges(); var controller = new ContentController(context, logger.Object); //Act var result = await controller.Get(); //Assert // Verifying that ILogger is working is a bit of a rabbit hole. // For now it really isn't of interest... but it is technically possible var contentResult = Assert.IsAssignableFrom <IEnumerable <Content> >(result); Assert.NotNull(contentResult); Assert.Contains(content1, contentResult); Assert.Contains(content2, contentResult); Assert.Contains(content3, contentResult); }
public UserController(WanderListDbContext context, ILogger <AppUser> logger) { _logger = logger; _context = context; }
public UserResourceController(WanderListDbContext context, ILogger <Resource> logger) { _context = context; _logger = logger; }
public UserShortlistController(WanderListDbContext context, ILogger <Shortlist> logger) { _context = context; _logger = logger; }
public UserHistoryController(WanderListDbContext context, ILogger <History> logger) { _context = context; _logger = logger; }
public UserRewardController(WanderListDbContext context, ILogger <AppUser> logger) { _context = context; _logger = logger; }
public CityContentController(WanderListDbContext context, ILogger <City> logger) { _logger = logger; _context = context; }
public MapViewController(WanderListDbContext context, ILogger <MapResponse> logger) { _logger = logger; _context = context; }
public ResourceController(WanderListDbContext context, ILogger <ResourceMeta> logger, IWebHostEnvironment env) { _context = context; _logger = logger; _env = env; }
public ActivityController(WanderListDbContext context, ILogger <Activity> logger) { _logger = logger; _context = context; }
public ItemController(WanderListDbContext context, ILogger <Item> logger) { _logger = logger; _context = context; }
public DestinationController(WanderListDbContext context, ILogger <Destination> logger) { _logger = logger; _context = context; }
public QRController(WanderListDbContext context, ILogger <ResourceMeta> logger) { _context = context; _logger = logger; }
public RewardController(WanderListDbContext context, ILogger <Reward> logger) { _context = context; _logger = logger; }
public ContentResourceMetaController(WanderListDbContext context, ILogger <Content> logger) { _context = context; _logger = logger; }
public ContentHistoryController(WanderListDbContext context, ILogger <Content> logger) { _context = context; _logger = logger; }