void Start() { // StartCoroutine(ScreenShotPNG()); // IEnumerator ienmuertor = NextHaveData(); // bool hasNext=ienmuertor.MoveNext(); // print("第一次调用"); // print("是否有数据:"+hasNext); // hasNext = ienmuertor.MoveNext(); // print("第二次调用"); // print("是否有数据:"+hasNext); // hasNext = ienmuertor.MoveNext(); // print("第三次调用"); // print("是否有数据:"+hasNext+"current:"+ienmuertor.Current); mr = this.GetComponent <MeshRenderer>(); onSuccess += this.OnSuccessFuc; HttpWrapper hw = GetComponent <HttpWrapper>(); hw.Get(@"http://www.bz55.com/uploads/allimg/160601/140-1606010R501.jpg", onSuccess); Int32?testNull = null; Int32?testInt = testNull ?? 99; Debug.Log(testInt.HasValue + " " + testInt.Value); Debug.Log(testNull.HasValue + " " + testNull.GetValueOrDefault()); }
public async Task WhenQueryParametersAreAddedViaDictionary_UrlIsCorrectlyConstructed() { var stubHandler = new FakeHttpMessageHandler(new HttpResponseMessage(HttpStatusCode.OK)); var http = new HttpWrapper("http://foo.com/", new TestLogger(), new Envelope(new TextMessage(CreateTestUser(), "test", "id")), stubHandler); http.Query(new Dictionary<string, string>{{"foo", "Foo"}, {"bar", "Bar"}}); await http.Get(); Assert.AreEqual("http://foo.com/?foo=Foo&bar=Bar", stubHandler.LastRequest.RequestUri.ToString()); }
public async Task WhenQueryParametersAreAddedindividually_UrlIsCorrectlyConstructed() { var stubHandler = new FakeHttpMessageHandler(new HttpResponseMessage(HttpStatusCode.OK)); var http = new HttpWrapper("http://foo.com/", new TestLogger(), new Envelope(new TextMessage(CreateTestUser(), "test")), stubHandler); http.Query("foo", "Foo"); http.Query("bar", "Bar"); await http.Get(); Assert.Equal("http://foo.com/?foo=Foo&bar=Bar", stubHandler.LastRequest.RequestUri.ToString()); }
public async Task WhenQueryParametersAreAddedByAnonymousType_UrlIsCorrectlyConstructed() { var stubHandler = new FakeHttpMessageHandler(new HttpResponseMessage(HttpStatusCode.OK)); var http = new HttpWrapper("http://foo.com/", new TestLogger(), new Envelope(new TextMessage(CreateTestUser(), "test")), stubHandler); http.Query(new { foo = "Foo", bar = "Bar" }); await http.Get(); Assert.Equal("http://foo.com/?foo=Foo&bar=Bar", stubHandler.LastRequest.RequestUri.ToString()); }
private async void WrapperExample_Click(object sender, EventArgs e) { HttpWrapper wrapper = new HttpWrapper(new System.Net.Http.HttpClient()); PlayerAPIdummie player = await wrapper.Get <PlayerAPIdummie>("https://towerdefenseapi.azurewebsites.net/api/players/3"); }