public async Task GetFontsAsyncFromFile() { var path = new DirectoryInfo(System.Environment.CurrentDirectory); var file = new FileInfo(System.IO.Path.Combine(path.FullName, ValidateGillSans.UrlPath)); using (var reader = new TypefaceReader()) { var faces = await reader.GetFontsAsync(file); ValidateGillSans.AssertTypefaces(faces.ToArray()); } }
public async Task GetFontsAsyncFromUri() { var path = new Uri(ValidateGillSans.RootUrl + ValidateGillSans.UrlPath); //Clean reader with a file stream using (var reader = new TypefaceReader()) { var faces = await reader.GetFontsAsync(path); ValidateGillSans.AssertTypefaces(faces.ToArray()); } }
public async Task GetFontsAsyncFromRelativeUrl() { var path = new Uri(ValidateGillSans.RootUrl); //Set the base url using (var reader = new TypefaceReader(path)) { //Set the relative path path = new Uri(ValidateGillSans.UrlPath, UriKind.Relative); var faces = await reader.GetFontsAsync(path); ValidateGillSans.AssertTypefaces(faces.ToArray()); } }
public async Task FailGetFontsAsyncFromRelativeUrl() { var path = new Uri(ValidateHelvetica.RootUrl); //Set the base url using (var reader = new TypefaceReader(path)) { //Set the relative path path = new Uri("INVALID/" + ValidateHelvetica.UrlPath, UriKind.Relative); await Assert.ThrowsExceptionAsync <HttpRequestException>(async() => { var faces = await reader.GetFontsAsync(path); ValidateGillSans.AssertTypefaces(faces.ToArray()); }); } }