Exemplo n.º 1
0
        /// <summary>
        /// This endpoint fetches all Rules for a Domain
        /// </summary>
        /// <param name="request">GetAllRulesRequest object.</param>
        /// <returns></returns>
        public async Task <GetAllRulesResponse> GetAllRulesAsync(GetAllRulesRequest request)
        {
            var requestObject = httpClient.GetRequest(endpointUrl + "/{domain_id}/rules", Method.GET);

            requestObject.AddUrlSegment("domain_id", request.DomainId);

            var response = await httpClient.ExecuteAsync <GetAllRulesResponse>(requestObject);

            return(response);
        }
        public async Task GetAllRulesAsync()
        {
            var request = new GetAllRulesRequest()
            {
                DomainId = Domain.Id
            };
            var response = await mailinatorClient.RulesClient.GetAllRulesAsync(request);

            Assert.IsTrue(response != null);
        }
        private Rule GetFirstRuleFromServer()
        {
            var getAllRulesRequest = new GetAllRulesRequest()
            {
                DomainId = Domain.Id
            };
            var getAllRulesResponse = mailinatorClient.RulesClient.GetAllRulesAsync(getAllRulesRequest).Result;

            if (getAllRulesResponse == null)
            {
                throw new ArgumentNullException(nameof(getAllRulesResponse));
            }

            var rule = getAllRulesResponse.Rules.FirstOrDefault();

            if (rule == null)
            {
                throw new ArgumentNullException(nameof(rule));
            }

            return(rule);
        }