public async Task Test_validate_temperature_data() { WeatherInfoEventArgs eventArgs = null; _weatherChannel.Subscribe("Test Subscriber", delegate(object sender, WeatherInfoEventArgs e) { eventArgs = e; }); await _weatherChannel.ProcessInputDataAsync(new WeatherData { Location = "kochi", Celsius = 30 }); int fahren = (30 * 9) / 5 + 32; Assert.AreEqual(30, eventArgs.Celsius); Assert.AreEqual(fahren, eventArgs.Fahrenheit); }
public async Task PublishDataAsync() { Console.Write("Enter the location : "); var location = Console.ReadLine(); Console.Write("Enter the Temperature in Celsius(°C) : "); int.TryParse(Console.ReadLine(), out int celsius); await _weatherChannel.ProcessInputDataAsync(new WeatherData { Location = location, Celsius = celsius }); }