public void CallRestServicePostTodo() { var cmd = new CallRestServiceCommand() { ApiName = "Test1", ServiceName = "posts", ResponseContentPropertyName = "ResponseContent", RequestContentPropertyName = "RequestContent" }; var context = new JsonPlaceholderContext { RequestContent = new { title = "hello world", body = "dude", userId = 10101 } }; var restCallTask = cmd.Execute(this.svcProvider, context); restCallTask.RunSynchronously(); Assert.AreEqual(restCallTask.Result.IsSuccess, true); var userIdVal = context.ResponseContent.Value <int>("userId"); Assert.AreEqual(userIdVal, 10101); var title = PropertyResolver.GetPropertyValue <string>(context.ResponseContent, "title"); Assert.IsTrue(title.StartsWith("hello world")); }
public void CallRestServiceGetNoParams() { var cmd = new CallRestServiceCommand() { ApiName = "Test1", ServiceName = "todos", ResponseContentPropertyName = "ResponseContent" }; var context = new JsonPlaceholderContext { Id = 1 }; var restCallTask = cmd.Execute(this.svcProvider, context); restCallTask.RunSynchronously(); Assert.AreEqual(restCallTask.Result.IsSuccess, true); var idVal = context.ResponseContent.Value <int>("id"); Assert.AreEqual(idVal, 1); var title = PropertyResolver.GetPropertyValue <string>(context.ResponseContent, "title"); Assert.IsTrue(title.StartsWith("delectus")); }