Пример #1
0
        public override Task <KafkaService> Locate(string serviceName)
        {
            string longName;

            if (string.IsNullOrWhiteSpace(serviceName))
            {
                longName = serviceName = "_kafka";
            }
            else
            {
                longName = $"{serviceName.ToLowerInvariant()}._kafka";
            }

            // get name of service to resolve
            ServiceDnsName name = new ServiceDnsName
            {
                Domain      = ServiceDomain,
                ServiceName = serviceName,
                Protocol    = "kafka",
                DnsName     = string.IsNullOrEmpty(ServiceDomain)
                    ? serviceName.ToLowerInvariant()
                    : $"{longName}._tcp.{ServiceDomain}"
            };

            return(Locate(name, _ => ServiceLookup.SrvTxt(name, KafkaServiceFactory)));
        }
        public void Setup()
        {
            helper = new Mock <IHelper>();

            service = new ServiceLookup();
            service.LoadCalculatorPanelAsset();

            calculatorPanel = new TestStandardCalculatorPanel(

                service.KeyChecker,
                service.NumberFormatter,
                service.ExpressionFormatter,

                new StandardCalculator(

                    service.InputBuffer,
                    service.Operators,
                    service.UnitConverter,
                    service.OperatorConverter,
                    service.ExpressionBuilder,
                    service.ExpressionParser,
                    service.Evaluator,
                    service.MemoryStorage
                    )
                );
        }
Пример #3
0
        public Task <DatabaseService> Locate(string serviceName, string protocol)
        {
            if (string.IsNullOrWhiteSpace(serviceName))
            {
                throw new ArgumentNullException(nameof(serviceName));
            }

            if (string.IsNullOrWhiteSpace(protocol))
            {
                throw new ArgumentNullException(nameof(protocol));
            }

            // lower-invariant protocol
            protocol = protocol.ToLowerInvariant();

            // get name of service to resolve
            ServiceDnsName name = new ServiceDnsName
            {
                Domain      = ServiceDomain,
                ServiceName = serviceName,
                Protocol    = protocol,
                DnsName     = string.IsNullOrEmpty(ServiceDomain)
                    ? serviceName.ToLowerInvariant()
                    : $"{serviceName.ToLowerInvariant()}._{protocol}._tcp.{ServiceDomain}"
            };

            // locate and return
            return(Locate(name, _ => ServiceLookup.SrvTxt(name, DbServiceFactory)));
        }
Пример #4
0
        public void Setup()
        {
            service = new ServiceLookup();
            service.LoadCalculatorPanelAsset();

            calculatorPanel = new TestScientificCalculatorPanel(

                service.KeyChecker,
                service.NumberFormatter,
                service.ExpressionFormatter,
                service.EngineeringFormatter,

                new ScientificCalculator(

                    service.InputBuffer,
                    service.Operators,
                    service.UnitConverter,
                    service.OperatorConverter,
                    service.ExpressionBuilder,
                    service.ExpressionParser,
                    service.Evaluator,
                    service.MemoryStorage
                    )
                );
        }
Пример #5
0
        private IEnumerable <UspsDeliveryOption> GetDeliveryOptions(int serviceCode, IShipment package)
        {
            IList <UspsDeliveryOption> options;

            if (!ServiceLookup.TryGetValue(serviceCode, out options))
            {
                return(null);
            }

            return(options);
        }
Пример #6
0
        public void Setup()
        {
            button = new Button();

            service = new ServiceLookup();
            service.LoadConverterPanelAsset();

            converterPanel = new TestConverterPanel(

                service.InputBuffer,
                service.KeyChecker,
                service.NumberFormatter,
                new AngleConverter(),
                new ConverterDisplay(),
                new string[] { "Degrees", "Radians", "Gradians" }
                );
        }
Пример #7
0
        public Task <DatabaseService> Locate(DatabaseProtocol protocol)
        {
            // lower-invariant protocol & service name
            string protocolName = protocol.ToString().ToLowerInvariant();
            string serviceName  = $"_{protocolName}";

            // get name of service to resolve
            ServiceDnsName name = new ServiceDnsName
            {
                Domain      = ServiceDomain,
                ServiceName = serviceName,
                Protocol    = protocolName,
                DnsName     = string.IsNullOrEmpty(ServiceDomain)
                    ? serviceName.ToLowerInvariant()
                    : $"{serviceName.ToLowerInvariant()}._tcp.{ServiceDomain}"
            };

            // locate and return
            return(Locate(name, _ => ServiceLookup.SrvTxt(name, DbServiceFactory)));
        }
Пример #8
0
        public override Task <WebApiService> Locate(string serviceName)
        {
            if (string.IsNullOrWhiteSpace(serviceName))
            {
                throw new ArgumentNullException(nameof(serviceName));
            }

            // get name of service to resolve
            ServiceDnsName name = new ServiceDnsName
            {
                Domain      = ServiceDomain,
                ServiceName = serviceName,
                Protocol    = "http",
                DnsName     = string.IsNullOrEmpty(ServiceDomain)
                    ? serviceName.ToLowerInvariant()
                    : $"{serviceName.ToLowerInvariant()}._http._tcp.{ServiceDomain}"
            };

            return(Locate(name, _ => ServiceLookup.SrvTxt(name, WebApiServiceFactory)));
        }
Пример #9
0
        public Task <GenericService> Locate(string serviceName, IpProtocol protocol)
        {
            if (string.IsNullOrWhiteSpace(serviceName))
            {
                throw new ArgumentNullException(nameof(serviceName));
            }

            // get name of service to resolve
            string         sProtocol = protocol.ToString().ToLowerInvariant();
            ServiceDnsName name      = new ServiceDnsName
            {
                Domain      = ServiceDomain,
                ServiceName = serviceName,
                Protocol    = sProtocol,
                DnsName     = string.IsNullOrEmpty(ServiceDomain)
                    ? serviceName.ToLowerInvariant()
                    : $"{serviceName.ToLowerInvariant()}._{sProtocol}.{ServiceDomain}"
            };

            return(Locate(name, _ => ServiceLookup.SrvTxt(name, MyServiceFactory)));
        }
Пример #10
0
 internal override SrvLookup <GrpcService> LocateFunction(string dnsName) => ServiceLookup.SrvTxt(Name, Factory);
Пример #11
0
 internal virtual SrvLookup <GrpcService> LocateFunction(string dnsName) => ServiceLookup.Srv(Name, Factory);
 public static void RegisterOpenAuth()
 {
     OpenAuth.AuthenticationClients.Add("Linked In", () => ServiceLookup.GetLinkedInService());
 }