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);
        }
Example #2
0
 public UserController(WanderListDbContext context, ILogger <AppUser> logger)
 {
     _logger  = logger;
     _context = context;
 }
Example #3
0
 public UserResourceController(WanderListDbContext context, ILogger <Resource> logger)
 {
     _context = context;
     _logger  = logger;
 }
Example #4
0
 public UserShortlistController(WanderListDbContext context, ILogger <Shortlist> logger)
 {
     _context = context;
     _logger  = logger;
 }
Example #5
0
 public UserHistoryController(WanderListDbContext context, ILogger <History> logger)
 {
     _context = context;
     _logger  = logger;
 }
Example #6
0
 public UserRewardController(WanderListDbContext context, ILogger <AppUser> logger)
 {
     _context = context;
     _logger  = logger;
 }
 public CityContentController(WanderListDbContext context, ILogger <City> logger)
 {
     _logger  = logger;
     _context = context;
 }
Example #8
0
 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;
 }
Example #10
0
 public ActivityController(WanderListDbContext context, ILogger <Activity> logger)
 {
     _logger  = logger;
     _context = context;
 }
Example #11
0
 public ItemController(WanderListDbContext context, ILogger <Item> logger)
 {
     _logger  = logger;
     _context = context;
 }
Example #12
0
 public DestinationController(WanderListDbContext context, ILogger <Destination> logger)
 {
     _logger  = logger;
     _context = context;
 }
 public QRController(WanderListDbContext context, ILogger <ResourceMeta> logger)
 {
     _context = context;
     _logger  = logger;
 }
Example #14
0
 public RewardController(WanderListDbContext context, ILogger <Reward> logger)
 {
     _context = context;
     _logger  = logger;
 }
Example #15
0
 public ContentResourceMetaController(WanderListDbContext context, ILogger <Content> logger)
 {
     _context = context;
     _logger  = logger;
 }
Example #16
0
 public ContentHistoryController(WanderListDbContext context, ILogger <Content> logger)
 {
     _context = context;
     _logger  = logger;
 }