Beispiel #1
0
        public Task <TestPayload> JsonTest(TestPayload payload)
        {
            if (payload != null && payload.Number == 12340000 && payload.Text == "Test text")
            {
                return(Task.FromResult(payload));
            }

            throw new ArgumentException(nameof(payload));
        }
Beispiel #2
0
        public async Task PostTest()
        {
            var payload = new TestPayload();

            payload.Number = 12340000;
            payload.Text   = "Test text";

            var url             = "/grains/Test/Orleans.Http.Test.ITestGrain/00000000-0000-0000-0000-000000000000/post7";
            var responsePayload = await this._http.PostProtobuf <TestPayload, TestPayload>(url, payload);

            Assert.True(responsePayload.Number == payload.Number);
            Assert.True(responsePayload.Text == payload.Text);
        }
Beispiel #3
0
        public async Task JsonTest()
        {
            var payload = new TestPayload();

            payload.Number = 12340000;
            payload.Text   = "Test text";

            var url      = "/grains/test/00000000-0000-0000-0000-000000000000/JsonTest";
            var response = await this._http.PostAsync(url, new StringContent(JsonSerializer.Serialize(payload, typeof(TestPayload)), Encoding.UTF8, TestExtensions.JSON));

            Assert.True(response.IsSuccessStatusCode);
            var stream = await response.Content.ReadAsStreamAsync();

            var resp = await JsonSerializer.DeserializeAsync <TestPayload>(stream);

            Assert.True(payload.Number == resp.Number);
            Assert.True(payload.Text == resp.Text);
        }
Beispiel #4
0
 public Task <TestPayload> Post7([FromBody] TestPayload body) => Task.FromResult(body);
Beispiel #5
0
 public Task Post4([FromBody] TestPayload body) => Task.FromResult(body);
Beispiel #6
0
 public Task Post3(TestPayload body) => Task.FromResult(body);