public async Task CallingFeaturedImageQueryGetReturnsFeaturedImage() { var image = new FeaturedImage { Date = DateTime.Now, ImageId = ObjectId.GenerateNewId() }; var repositoryMock = new Mock <IFeaturedImageRepository>(); repositoryMock.Setup(x => x.GetLatest()).Returns(image); var query = new FeaturedImageQuery(repositoryMock.Object); var featuredImage = await query.Get(null).ConfigureAwait(false); Assert.That(featuredImage, Is.Not.Null); Assert.That(featuredImage.Date, Is.Not.Null); Assert.That(featuredImage.ImageId, Is.Not.Null); Assert.That(featuredImage.ImageId, Is.Not.EqualTo(ObjectId.Empty)); Assert.That(featuredImage.Date.Year, Is.GreaterThan(1)); }
public async Task <ActionResult> GetFeaturedImage() { var featuredImage = await FeaturedImageQuery.Get(null).ConfigureAwait(false); return(new OkObjectResult(featuredImage)); }