public void Constructor_Initializes_Correctly()
        {
            var instOptions = new EurekaInstanceOptions();
            var wrap        = new TestOptionMonitorWrapper <EurekaInstanceOptions>(instOptions);
            var mgr         = new EurekaApplicationInfoManager(wrap);

            Assert.Equal(instOptions, mgr.InstanceConfig);
        }
Пример #2
0
        public void Constructor_Initializes_Correctly()
        {
            var instOptions = new EurekaInstanceOptions();
            var clientOptions = new EurekaClientOptions();
            var wrapInst = new TestOptionMonitorWrapper<EurekaInstanceOptions>(instOptions);
            var wrapClient = new TestOptionMonitorWrapper<EurekaClientOptions>(clientOptions);
            var appMgr = new EurekaApplicationInfoManager(wrapInst);
            var client = new EurekaDiscoveryClient(wrapClient, wrapInst, appMgr);

            var mgr = new EurekaDiscoveryManager(wrapClient, wrapInst, client);
            Assert.Equal(instOptions, mgr.InstanceConfig);
            Assert.Equal(clientOptions, mgr.ClientConfig);
            Assert.Equal(client, mgr.Client);
        }
Пример #3
0
        public void Constructor_Initializes_Correctly()
        {
            var clientConfig = new EurekaClientOptions()
            {
                ShouldRegisterWithEureka = false,
                ShouldFetchRegistry      = false
            };

            var cwrapper = new TestOptionMonitorWrapper <EurekaClientOptions>(clientConfig);

            var instConfig = new EurekaInstanceOptions();
            var iwrapper   = new TestOptionMonitorWrapper <EurekaInstanceOptions>(instConfig);

            var appMgr = new EurekaApplicationInfoManager(iwrapper);
            var client = new EurekaDiscoveryClient(cwrapper, iwrapper, appMgr);

            Assert.NotNull(client.ClientConfig);
            Assert.Equal(clientConfig, client.ClientConfig);
            Assert.NotNull(client.HttpClient);
            Assert.NotNull(client.Description);
            Assert.NotNull(client.Services);
            Assert.Empty(client.Services);

            var thisService = client.GetLocalServiceInstance();

            Assert.NotNull(thisService);
            Assert.Equal(instConfig.GetHostName(false), thisService.Host);
            Assert.Equal(instConfig.SecurePortEnabled, thisService.IsSecure);
            Assert.NotNull(thisService.Metadata);
            Assert.Equal(instConfig.NonSecurePort, thisService.Port);
            Assert.Equal(instConfig.AppName, thisService.ServiceId);
            Assert.NotNull(thisService.Uri);
            string scheme  = instConfig.SecurePortEnabled ? "https" : "http";
            int    uriPort = instConfig.SecurePortEnabled ? instConfig.SecurePort : instConfig.NonSecurePort;
            var    uri     = new Uri(scheme + "://" + instConfig.GetHostName(false) + ":" + uriPort.ToString());

            Assert.Equal(uri, thisService.Uri);
        }