public async Task GetImageDimensions(string filePath, string databaseName, int width, int height) { // Arrange var options = new DbContextOptionsBuilder <MyAlbumDbContext>() .UseInMemoryDatabase(databaseName: databaseName) .Options; using (var context = new MyAlbumDbContext(options)) { PhotoRepository photoRepository = new PhotoRepository(context); IFormFile file = null; if (!string.IsNullOrEmpty(filePath)) { file = GetFormFile(filePath); } // Act var result = await photoRepository.GetImageDimensions(file); // Assert Assert.Equal(width, result.Width); Assert.Equal(height, result.Height); } }