예제 #1
0
        public void should_corectly_prepare_dto()
        {
            var dto = new ZoneMailRedirectRequest
            {
                DestinationAddress = DestinationAddress,
                SourceAddress      = SourceAddress
            };

            var json = dto.Prepare();

            json.ShouldContain(SourceAddress);
            json.ShouldContain(DestinationAddress);
        }
예제 #2
0
        public async Task <ZoneMailRedirect> CreateMailRedirectAsync(int zoneId, string sourceAddress,
                                                                     string destinationAddress)
        {
            var requestDto = new ZoneMailRedirectRequest
            {
                DestinationAddress = destinationAddress,
                SourceAddress      = sourceAddress
            };

            var response = await _client.Post($"{BaseUrl}/{zoneId}/mail_redirects", requestDto.Prepare());

            ErrorHandler(response.StatusCode);

            var content = await response.Content.ReadAsStringAsync();

            var responseDto = JsonConvert.DeserializeObject <ZoneMailRedirectResponse>(content);

            return(responseDto.Extract());
        }