Exemplo n.º 1
0
    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());
    }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
        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());
        }
Exemplo n.º 5
0
 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");
 }