protected static void AreEqual(LocalizableString exp, LocalizableString act) { if (exp != null) { Assert.Equal(exp.LocalizedValue, act.LocalizedValue); Assert.Equal(exp.Value, act.Value); } }
private async Task<Log> FetchLogFromBlob(string blobUri, MetricFilter filter, LocalizableString category) { var blob = new CloudBlockBlob(new Uri(blobUri)); using (var memoryStream = new MemoryStream()) { try { await blob.DownloadToStreamAsync(memoryStream); } catch (StorageException ex) { if (ex.RequestInformation.HttpStatusCode == 404) { return new Log { Category = new LocalizableString { LocalizedValue = category.LocalizedValue, Value = category.Value }, StartTime = filter.StartTime, EndTime = filter.EndTime, Value = new List<LogValue>() }; } throw; } memoryStream.Seek(0, 0); using (var streamReader = new StreamReader(memoryStream)) { string content = await streamReader.ReadToEndAsync(); var logBlob = JsonConvert.DeserializeObject<LogBlob>(content); var logValues = logBlob.records.Where(x => x.Time >= filter.StartTime && x.Time < filter.EndTime).ToList(); return new Log { Category = category, StartTime = filter.StartTime, EndTime = filter.EndTime, Value = logValues }; } } }
/// <summary> /// Initializes a new instance of the PSLocalizableString class /// </summary> /// <param name="localizableString">The input LocalizableString object</param> public PSLocalizableString(LocalizableString localizableString) { this.localizableString = localizableString; }