public void Setup() { _systemInfo = Mock.Create <ISystemInfo>(); _agentHealthReporter = Mock.Create <IAgentHealthReporter>(); Mock.Arrange(() => _systemInfo.GetTotalLogicalProcessors()).Returns(6); Mock.Arrange(() => _systemInfo.GetTotalPhysicalMemoryBytes()).Returns((ulong)16000 * 1024 * 1024); _dnsStatic = Mock.Create <IDnsStatic>(); Mock.Arrange(() => _dnsStatic.GetHostName()).Returns("Host-Name"); Mock.Arrange(() => _dnsStatic.GetFullHostName()).Returns("Host-Name.Domain"); Mock.Arrange(() => _dnsStatic.GetIpAddresses()).Returns(new List <string> { "127.0.0.1", "0.0.0.0" }); }
private ConnectModel GetConnectParameters() { var identifier = GetIdentifier(); var appNames = _configuration.ApplicationNames.ToList(); if (!appNames.Any()) { appNames.Add(identifier); } Log.InfoFormat("Your New Relic Application Name(s): {0}", string.Join(":", appNames.ToArray())); var metadata = _environmentVariableHelper.GetEnvironmentVariablesWithPrefix("NEW_RELIC_METADATA_"); return(new ConnectModel( _processStatic.GetCurrentProcess().Id, "dotnet", _configuration.ProcessHostDisplayName, _dnsStatic.GetHostName(), appNames, AgentInstallConfiguration.AgentVersion, AgentInstallConfiguration.AgentVersionTimestamp, new SecuritySettingsModel ( _configuration.CaptureRequestParameters, new TransactionTraceSettingsModel(_configuration.TransactionTracerRecordSql) ), _configuration.HighSecurityModeEnabled, identifier, _labelsService.Labels, GetJsAgentSettings(), metadata ?? new Dictionary <string, string>(), new UtilizationStore(_systemInfo, _dnsStatic, _configuration, _agentHealthReporter).GetUtilizationSettings(), _configuration.CollectorSendEnvironmentInfo ? _environment : null, _configuration.SecurityPoliciesTokenExists ? new SecurityPoliciesSettingsModel(_configuration) : null, new EventHarvestConfigModel(_configuration) )); }