public void SetDefaultForDisableNotificationIsHandled(string actual, bool expected) { var mapper = new TelegramBotMapper(new TelegramBotClient(ApiKey), this.responseFactory); JsonConvert.DeserializeObject <Response <string> >(mapper.SetDefaultValue($"{nameof(mapper.DisableNotifications)}", actual)); Assert.Equal(expected, mapper.DisableNotifications); var result = JsonConvert.DeserializeObject <Response <Error> >(mapper.SetDefaultValue($"{nameof(mapper.DisableNotifications)}", "unknown")); Assert.Equal(typeof(ArgumentException).Name, result.Content.ExceptionType); }
public void SetDefaultForUnknownKeyThrowsException() { var mapper = new TelegramBotMapper(new TelegramBotClient(ApiKey), this.responseFactory); var result = JsonConvert.DeserializeObject <Response <Error> >(mapper.SetDefaultValue($"UnknownStuff", "test")); Assert.Equal(typeof(KeyNotFoundException).Name, result.Content.ExceptionType); }