public void Create_WithDefinedHostAndPort_Test()
        {
            var host = CreatePlaceholder <string>();
            var port = CreatePlaceholder <int>();

            When(systemState.Get(RemoteChronokeeperConfigurationConstants.kHostKey, null)).ThenReturn(host);
            When(systemState.Get(RemoteChronokeeperConfigurationConstants.kPortKey, null)).ThenReturn(port.ToString());

            var result = testObj.Create();

            Verify(systemState).Get(RemoteChronokeeperConfigurationConstants.kHostKey, null);
            Verify(systemState).Get(RemoteChronokeeperConfigurationConstants.kPortKey, null);
            VerifyNoMoreInteractions();

            AssertEquals(host, result.Host);
            AssertEquals(port, result.Port);
        }
        public RemoteChronokeeperConfiguration Create()
        {
            var host       = systemState.Get(kHostKey, null);
            var portString = systemState.Get(kPortKey, null);

            if (host == null)
            {
                logger.Warn($"Defaulting to {kDefaultHostValue} as remote chronokeeper host is undefined.");
                host = kDefaultHostValue;
            }
            int port;

            if (portString == null || !int.TryParse(portString, out port))
            {
                logger.Warn($"Defaulting to {kDefaultHostValue} as remote chronokeeper port is undefined or unparsable.");
                port = kDefaultPortValue;
            }
            return(new RemoteChronokeeperConfigurationImpl {
                Host = host,
                Port = port
            });
        }
        private long GetTokenExpirationMillisecondsInternal(string key, long defaultValue)
        {
            var  stringValue = systemState.Get(key, null);
            long value;

            if (string.IsNullOrWhiteSpace(stringValue) || !long.TryParse(stringValue, out value))
            {
                return(defaultValue);
            }
            else
            {
                return(value);
            }
        }
Ejemplo n.º 4
0
        public static NetLogoObject Setxy(Number x, Number y)
        {
            if (sys.GetCurrentFrame().isAsk)
            {
                MetaAgent m = (MetaAgent)sys.Get("Agent");

                m.properties.SetProperty("X", new Integer()
                {
                    value = x.value
                });
                m.properties.SetProperty("Y", new Integer()
                {
                    value = y.value
                });
                m.x = (int)x.val;
                m.y = (int)y.val;
            }

            return(new NetLogoObject()
            {
                ptrID = "NULLPTR"
            });
        }
 public LeagueBuildUtilitiesConfiguration(SystemState systemState) {
    this.systemState = systemState;
    this.isLoggingEnabled = systemState.Get(kEnableBuildLoggingKey, false);
 }
Ejemplo n.º 6
0
 public LeagueBuildUtilitiesConfiguration(SystemState systemState)
 {
     this.systemState      = systemState;
     this.isLoggingEnabled = systemState.Get(kEnableBuildLoggingKey, false);
 }
 public string Get(string key) => systemState.Get(key, null);