public static void GasRunner([TimerTrigger("0 */5 * * * *", RunOnStartup = true)] TimerInfo timerInfo, TextWriter log) { log.WriteLine($"C# Timer trigger function executed at: {DateTime.Now}"); var gs = new GasPriceService(); var gm = gs.GetGasMeasure(); var gp = new GasAzurePersistor(AmbientConnectionStringProvider.Instance.GetConnectionString(ConnectionStringNames.Storage)); gp.Save(gm); log.WriteLine($"Result: RSK={gm.RskGasPriceInUsd()} - ETH={gm.EthGasPriceInUsd()}"); }
public void WhenSaveAMeasurementThenSaves() { var gap = new GasAzurePersistor(ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ConnectionString); const int rsk = 1; var d = DateTime.UtcNow; gap.Save(new GasMeasurement { Moment = d, RSKMinGasPrice = rsk }); var l = gap.Get(d); Assert.AreEqual(rsk, l.Last().RSKMinGasPrice); }