public void GetIcon_StateUnderTest_ExpectedBehavior(string fileName) { MemoryStreamIconGenerator.GenerateIcons(_iconData, Path.GetTempPath(), _mockLogger.Object); var result = MemoryStreamIconGenerator.GetIcon(fileName); Assert.IsNotNull(result); }
public IActionResult SiteIcon(string filename) { var iconBytes = MemoryStreamIconGenerator.GetIcon(filename); if (iconBytes is null) { return(NotFound()); } var contentType = "image/png"; var ext = Path.GetExtension(filename); contentType = ext switch { ".png" => "image/png", ".ico" => "image/x-icon", _ => contentType }; return(File(iconBytes, contentType)); }