public async void ItShallReturnCommuneData() { // given const string communeId = "123"; var expected = new CommuneCoronaStopLightStatus("commune", communeId, CoronaStopLightLevel.Green); coronaStopLightRepository.Setup(repo => repo.GetByCommuneId(communeId)).ReturnsAsync(expected); // when var actual = await sut.GetCommuneStatus(communeId); // then Assert.Equal(expected, actual); }
/// <inheritdoc /> public async Task SendCommuneStatus(CommuneCoronaStopLightStatus status) { var vm = new CommuneCoronaStopLightStatusViewModel(_telegramOptions.ChatId, _messageOptions.Format, _localizationService.GetForLevelAndLanguage(status.WarningLevel, _localizationOptions.Culture), _telegramOptions.ParseMode); var response = await _httpClient.PostAsync( $"{_telegramOptions.ApiBaseUrl}bot{_telegramOptions.AccessToken}/sendMessage", new StringContent(vm.AsJson(), Encoding.UTF8, "application/json")); if (response.StatusCode == HttpStatusCode.OK) { _logger.LogInformation("Successfully sent message via telegram"); } else { _logger.LogInformation("Sending of message via telegram failed with code '{code}'", response.StatusCode); } }