public override void OnLoad() { if (!SavedStrings.ContainsKey("display")) { SavedStrings.Add("display", "test"); } buttons = new List <ButtonPlug>(); buttons.Add(new ButtonPlug() { display = SavedStrings["display"] }); }
public Facts(ITestOutputHelper output) { CloudBlobClient = new Mock <ICloudBlobClient>(); CloudBlobContainer = new Mock <ICloudBlobContainer>(); CloudBlob = new Mock <ISimpleCloudBlob>(); Options = new Mock <IOptionsSnapshot <AzureSearchJobConfiguration> >(); TelemetryService = new Mock <IAzureSearchTelemetryService>(); Logger = output.GetLogger <PopularityTransferDataClient>(); Config = new AzureSearchJobConfiguration { StorageContainer = "unit-test-container", }; ETag = "\"some-etag\""; AccessCondition = new Mock <IAccessCondition>(); StringCache = new StringCache(); ReplaceLatestIndexedPopularityTransfersDurationMetric = new Mock <IDisposable>(); Options .Setup(x => x.Value) .Returns(() => Config); CloudBlobClient .Setup(x => x.GetContainerReference(It.IsAny <string>())) .Returns(() => CloudBlobContainer.Object); CloudBlobContainer .Setup(x => x.GetBlobReference(It.IsAny <string>())) .Returns(() => CloudBlob.Object) .Callback <string>(x => BlobNames.Add(x)); CloudBlob .Setup(x => x.ETag) .Returns(ETag); CloudBlob .Setup(x => x.OpenWriteAsync(It.IsAny <AccessCondition>())) .ReturnsAsync(() => new RecordingStream(bytes => { SavedBytes.Add(bytes); SavedStrings.Add(Encoding.UTF8.GetString(bytes)); })); CloudBlob .Setup(x => x.Properties) .Returns(new CloudBlockBlob(new Uri("https://example/blob")).Properties); TelemetryService .Setup(x => x.TrackReplaceLatestIndexedPopularityTransfers(It.IsAny <int>())) .Returns(ReplaceLatestIndexedPopularityTransfersDurationMetric.Object); Target = new PopularityTransferDataClient( CloudBlobClient.Object, Options.Object, TelemetryService.Object, Logger); }