Exemplo n.º 1
0
        public static IEnumerable <object[]> GetTestData()
        {
            yield return(new object[] { _restApiProvider.GetBroadcastEndpointAsync(_appName, _hubName), _commonEndpoint });

            yield return(new object[] { _restApiProvider.GetSendToUserEndpointAsync(_appName, _hubName, _userId), $"{_commonEndpoint}/users/{_userId}" });

            yield return(new object[] { _restApiProvider.GetSendToGroupEndpointAsync(_appName, _hubName, _groupName), $"{_commonEndpoint}/groups/{_groupName}" });

            yield return(new object[] { _restApiProvider.GetUserGroupManagementEndpointAsync(_appName, _hubName, _userId, _groupName), $"{_commonEndpoint}/groups/{_groupName}/users/{_userId}" });

            yield return(new object[] { _restApiProvider.GetSendToConnectionEndpointAsync(_appName, _hubName, _connectionId), $"{_commonEndpoint}/connections/{_connectionId}" });

            yield return(new object[] { _restApiProvider.GetConnectionGroupManagementEndpointAsync(_appName, _hubName, _connectionId, _groupName), $"{_commonEndpoint}/groups/{_groupName}/connections/{_connectionId}" });
        }
Exemplo n.º 2
0
        internal async Task EnableMessageTracingIdInRestApiTest(bool enable)
        {
            var api = await _restApiProvider.GetBroadcastEndpointAsync("app", "hub");

            var client = new RestClient(HttpClientFactory.Instance, new JsonSerializerSettings(), enable);

            try
            {
                await client.SendAsync(api, HttpMethod.Post, "", handleExpectedResponse : default).OrTimeout(200);
            }
            catch
            {
            }
            Assert.Equal(enable, api.Query?.ContainsKey(Constants.Headers.AsrsMessageTracingId) ?? false);
            if (enable)
            {
                var id = Convert.ToUInt64(api.Query[Constants.Headers.AsrsMessageTracingId]);
                Assert.Equal(MessageWithTracingIdHelper.Prefix, id);
            }
        }