public void WhenQueryAttributeHasConverterThenParameterValueIsConverted() { var queryDecoder = new QueryDecoder(); var parameters = queryDecoder.GetParameters(new StubConverterQuery { Item1 = "1" }); Assert.Equal("Converted", parameters["Item1"]); }
public void WhenQueryAttributeHasConverterThenParameterValueIsConverted() { var queryDecoder = new QueryDecoder(); var parameters = queryDecoder.GetParameters(new StubConverterQuery { StringItem = _stringItem1, DictItem = 42 }); Assert.Equal(_converted, parameters[_stringItem1ApiField]); Assert.Equal(_dictValue1, parameters[$"{_dictItemApiField}.{_dictKey1}"]); Assert.Equal(_dictValue2, parameters[$"{_dictItemApiField}.{_dictKey2}"]); Assert.Equal(_dictValue3, parameters[$"{_dictItemApiField}.{_dictKey3}"]); }
public void WhenQueryPassedThenOnlyAPIFieldAttributesAreReturned() { var queryDecoder = new QueryDecoder(); var parameters = queryDecoder.GetParameters(new StubQuery { Item = _item, StringItem1 = _stringItem1, StringItem2 = _stringItem2 }); // Unannotated property should not appear as it does not have APIField attribute Assert.Equal(2, parameters.Count); Assert.Equal(_stringItem1, parameters[_stringItem1ApiField]); Assert.Equal(_stringItem2, parameters[_stringItem2ApiField]); }
public void WhenQueryPassedThenOnlyAPIFieldAttributesAreReturned() { var queryDecoder = new QueryDecoder(); var parameters = queryDecoder.GetParameters(new StubQuery { Item1 = "1", Item2 = "2", Item3 = "3" }); // Property Item3 should not appear as it does not have APIField attribute Assert.Equal(2, parameters.Count); Assert.Equal("1", parameters["Item1"]); Assert.Equal("2", parameters["Item2"]); }
/// <summary> /// Check <see cref="IOauthRequestSender"/> /// </summary> /// <typeparam name="T">Check <see cref="IOauthRequestSender"/></typeparam> /// <param name="request">Check <see cref="IOauthRequestSender"/></param> /// <returns>Check <see cref="IOauthRequestSender"/></returns> public Task <T> SendRequestAsync <T>(Request <T> request) { var parameters = _queryDecoder.GetParameters(request.Query); return(BynderRestCallAsync <T>(request.HTTPMethod, request.Uri, parameters, request.DeserializeResponse)); }