Beispiel #1
0
        public async Task ExportSyncMethod_CreatesRoute()
        {
            var sz = new JsonSerialiser();

            using (var api = new HttpApi(sz, 9211))
            {
                api.ExportSyncMethod(1, x => x * 12, "func1");

                var url = new Uri(api.BaseEndpoint, "/func1/10");

                var result =
                    await api.TestRoute<int>(url);

                Assert.That(result, Is.EqualTo(120));
            }
        }
Beispiel #2
0
        public async Task ExportDefinedSyncMethod_CreatesRoute()
        {
            var sz = new JsonSerialiser();

            using (var api = new HttpApi(sz, 9211))
            {
                api.ExportSyncMethod(50, Functions.Random);

                var url = new Uri(api.BaseEndpoint, "/random/10");

                var result =
                    await api.TestRoute<int>(url);

                Assert.That(result, Is.AtLeast(0));
                Assert.That(result, Is.AtMost(10));
            }
        }