コード例 #1
0
        public MythServiceHost(string mythTvPath, string username, string password)
        {
            _password   = password;
            _userName   = username;
            _mythTvPath = new Uri(mythTvPath);

            _binding = new BasicHttpBinding();
            _binding.MaxReceivedMessageSize = int.MaxValue;

            if (!string.IsNullOrWhiteSpace(username) || !string.IsNullOrWhiteSpace(password))
            {
                _binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
            }

            _mythAddress    = new EndpointAddress(string.Format("{0}/Myth", mythTvPath));
            _guideAddress   = new EndpointAddress(string.Format("{0}/Guide", mythTvPath));
            _videoAddress   = new EndpointAddress(string.Format("{0}/Video", mythTvPath));
            _dvrAddress     = new EndpointAddress(string.Format("{0}/Dvr", mythTvPath));
            _contentAddress = new EndpointAddress(string.Format("{0}/Content", mythTvPath));
            _channelAddress = new EndpointAddress(string.Format("{0}/Channel", mythTvPath));
            _captureAddress = new EndpointAddress(string.Format("{0}/Capture", mythTvPath));


            DvrService     = new DvrClient(_binding, _dvrAddress);
            MythService    = new MythClient(_binding, _mythAddress);
            GuideService   = new GuideClient(_binding, _guideAddress);
            VideoService   = new VideoClient(_binding, _videoAddress);
            ContentService = new ContentClient(_binding, _contentAddress);
            ChannelService = new ChannelClient(_binding, _channelAddress);
            CaptureService = new CaptureClient(_binding, _captureAddress);

            DvrService.ClientCredentials.UserName.UserName     = _userName;
            DvrService.ClientCredentials.UserName.Password     = _password;
            MythService.ClientCredentials.UserName.UserName    = _userName;
            MythService.ClientCredentials.UserName.Password    = _password;
            GuideService.ClientCredentials.UserName.UserName   = _userName;
            GuideService.ClientCredentials.UserName.Password   = _password;
            VideoService.ClientCredentials.UserName.UserName   = _userName;
            VideoService.ClientCredentials.UserName.Password   = _password;
            ContentService.ClientCredentials.UserName.UserName = _userName;
            ContentService.ClientCredentials.UserName.Password = _password;
            ChannelService.ClientCredentials.UserName.UserName = _userName;
            ChannelService.ClientCredentials.UserName.Password = _password;
            CaptureService.ClientCredentials.UserName.UserName = _userName;
            CaptureService.ClientCredentials.UserName.Password = _password;
        }
コード例 #2
0
        public MythServiceHost(string mythTvPath, string username, string password)
        {
            _password = password;
            _userName = username;
            _mythTvPath = new Uri(mythTvPath);

            _binding = new BasicHttpBinding();
            _binding.MaxReceivedMessageSize = int.MaxValue;

            if (!string.IsNullOrWhiteSpace(username) || !string.IsNullOrWhiteSpace(password))
            {
                _binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
            }

            _mythAddress = new EndpointAddress(string.Format("{0}/Myth", mythTvPath));
            _guideAddress = new EndpointAddress(string.Format("{0}/Guide", mythTvPath));
            _videoAddress = new EndpointAddress(string.Format("{0}/Video", mythTvPath));
            _dvrAddress = new EndpointAddress(string.Format("{0}/Dvr", mythTvPath));
            _contentAddress = new EndpointAddress(string.Format("{0}/Content", mythTvPath));
            _channelAddress = new EndpointAddress(string.Format("{0}/Channel", mythTvPath));
            _captureAddress = new EndpointAddress(string.Format("{0}/Capture", mythTvPath));


            DvrService = new DvrClient(_binding, _dvrAddress);
            MythService = new MythClient(_binding, _mythAddress);
            GuideService = new GuideClient(_binding, _guideAddress);
            VideoService = new VideoClient(_binding, _videoAddress);
            ContentService = new ContentClient(_binding, _contentAddress);
            ChannelService = new ChannelClient(_binding, _channelAddress);
            CaptureService = new CaptureClient(_binding, _captureAddress);

            DvrService.ClientCredentials.UserName.UserName = _userName;
            DvrService.ClientCredentials.UserName.Password = _password;
            MythService.ClientCredentials.UserName.UserName = _userName;
            MythService.ClientCredentials.UserName.Password = _password;
            GuideService.ClientCredentials.UserName.UserName = _userName;
            GuideService.ClientCredentials.UserName.Password = _password;
            VideoService.ClientCredentials.UserName.UserName = _userName;
            VideoService.ClientCredentials.UserName.Password = _password;
            ContentService.ClientCredentials.UserName.UserName = _userName;
            ContentService.ClientCredentials.UserName.Password = _password;
            ChannelService.ClientCredentials.UserName.UserName = _userName;
            ChannelService.ClientCredentials.UserName.Password = _password;
            CaptureService.ClientCredentials.UserName.UserName = _userName;
            CaptureService.ClientCredentials.UserName.Password = _password;
        }
コード例 #3
0
        public async Task GetCaptureAsync_DefaultBehaviour_ResponseIsParsed()
        {
            // Given: We request a capture with a payment id and capture id
            string        expectedUrl   = $"{BaseMollieClient.ApiEndPoint}payments/{defaultPaymentId}/captures/{defaultCaptureId}";
            var           mockHttp      = this.CreateMockHttpMessageHandler(HttpMethod.Get, expectedUrl, defaultCaptureJsonResponse);
            HttpClient    httpClient    = mockHttp.ToHttpClient();
            CaptureClient captureClient = new CaptureClient("api-key", httpClient);

            // When: We make the request
            CaptureResponse captureResponse = await captureClient.GetCaptureAsync(defaultPaymentId, defaultCaptureId);

            // Then: Response should be parsed
            mockHttp.VerifyNoOutstandingExpectation();
            Assert.IsNotNull(captureResponse);
            Assert.AreEqual(defaultPaymentId, captureResponse.PaymentId);
            Assert.AreEqual(defaultShipmentId, captureResponse.ShipmentId);
            Assert.AreEqual(defaultSettlementId, captureResponse.SettlementId);
            Assert.AreEqual(defaultAmountValue, captureResponse.Amount.Value);
            Assert.AreEqual(defaultAmountCurrency, captureResponse.Amount.Currency);
        }