public async void GetImageReturnsFile(int id) { var options = CreateNewContextOptions(); // Run the test against one instance of the context using (var context = new PhotoSharingContext(options)) { using (PhotosController controller = new PhotosController(context)) { var photos = new List <Photo> { new Photo { Title = "Me standing on top of a mountain", Description = "I was very impressed with myself", UserName = "******", PhotoFile = new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 }, ImageMimeType = "image/jpeg", CreatedDate = DateTime.Today }, new Photo { Title = "My New Adventure Works Bike", Description = "It's the bees knees!", UserName = "******", PhotoFile = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }, ImageMimeType = "image/jpeg", CreatedDate = DateTime.Today }, new Photo { Title = "View from the start line", Description = "I took this photo just before we started over my handle bars.", UserName = "******", PhotoFile = new byte[] { 255, 255, 255, 255, 0, 0, 0, 0 }, ImageMimeType = "image/jpeg", CreatedDate = DateTime.Today } }; photos.ForEach(s => context.Photos.Add(s)); context.SaveChanges(); var result = (await controller.GetImage(id)) as ActionResult; Assert.Equal(typeof(FileContentResult), result.GetType()); } } }