public async Task CallWeakRequestWith_NoParamsAndNoReturnTypeAndNoType() { var dict = new Dictionary <string, object>(); var res = await ProxyProvider.Invoke(new HttpServiceRequest("Do", null, dict), typeof(JObject)); var json = (JToken)res; json.ShouldBe(null); }
public async Task CallWeakRequestWith_Int_ParamAndNoReturnType() { var dict = new Dictionary <string, object> { { "a", "5" } }; var res = await ProxyProvider.Invoke(new HttpServiceRequest("DoInt", typeof(ICalculatorService).FullName, dict), typeof(JObject)); ((JToken)res).Value <int>().ShouldBe(5); }
public async Task CallWeakRequestWith_ComplexObject_ParamAndNoReturnType() { var wrapper = new Wrapper { INT = 100, STR = "100" }; var dict = new Dictionary <string, object> { { "wrapper", JsonConvert.SerializeObject(wrapper) } }; var res = await ProxyProvider.Invoke(new HttpServiceRequest("DoComplex", typeof(ICalculatorService).FullName, dict), typeof(JObject)); ((JToken)res).ToObject <Wrapper>().INT.ShouldBe(wrapper.INT); ((JToken)res).ToObject <Wrapper>().STR.ShouldBe(wrapper.STR); }
public async Task ToUniversalTimeAsWeakRequest_FixedDates_ReturnsCorrectResult() { const string localDateString = "2016-07-31T10:00:00+03:00"; var localDateTime = DateTime.Parse(localDateString); var localDateTimeOffset = DateTimeOffset.Parse(localDateString); var dict = new Dictionary <string, object> { { "localDateTime", localDateTime }, { "localDateTimeOffset", localDateTimeOffset } }; var res = await ProxyProvider.Invoke(new HttpServiceRequest("ToUniversalTime", typeof(ICalculatorService).FullName, dict), typeof(JObject)); var json = (JToken)res; DateTimeOffset.Parse(json["Item1"].Value <string>()).ShouldBe(DateTime.Parse(localDateString).ToUniversalTime()); DateTimeOffset.Parse(json["Item2"].Value <string>()).ShouldBe(localDateTimeOffset.DateTime); }