public void Int64_converts_correctly()
        {
            var serverConfiguration = ServerConfiguration.FromDeserializedReturnValue(new Dictionary <string, object> {
                { "agent_run_id", (long)1234 }
            });

            Assert.AreEqual(1234, serverConfiguration.AgentRunId);
        }
        public void NullableInt32_converts_correctly()
        {
            var serverConfiguration = ServerConfiguration.FromDeserializedReturnValue(new Dictionary <string, object> {
                { "agent_run_id", (long)1234 }, { "sampling_rate", (int?)1357 }
            });

            Assert.AreEqual(1357, serverConfiguration.SamplingRate);
        }
        public void NullableInt32_converts_correctly_when_no_optional_value_is_provided()
        {
            var serverConfiguration = ServerConfiguration.FromDeserializedReturnValue(new Dictionary <string, object> {
                { "agent_run_id", (long)1234 }
            });

            Assert.IsNull(serverConfiguration.SamplingRate);
        }
        public void double_converts_correctly()
        {
            var serverConfiguration = ServerConfiguration.FromDeserializedReturnValue(new Dictionary <string, object> {
                { "agent_run_id", 0 }, { "apdex_t", 1.2d }
            });

            Assert.AreEqual(1.2, serverConfiguration.ApdexT);
        }
        public void string_converts_correctly()
        {
            var serverConfiguration = ServerConfiguration.FromDeserializedReturnValue(new Dictionary <string, object> {
                { "agent_run_id", 0 }, { "application_id", "Bacon!" }
            });

            Assert.AreEqual("Bacon!", serverConfiguration.RumSettingsApplicationId);
        }
        public void bool_converts_correctly()
        {
            var serverConfiguration = ServerConfiguration.FromDeserializedReturnValue(new Dictionary <string, object> {
                { "agent_run_id", 0 }, { "collect_analytics_events", false }
            });

            Assert.AreEqual(false, serverConfiguration.AnalyticsEventCollectionEnabled);
        }
Example #7
0
        private ServerConfiguration SendConnectRequest()
        {
            var connectParameters = GetConnectParameters();
            var responseMap       = SendNonDataRequest <Dictionary <string, object> >("connect", connectParameters);

            if (responseMap == null)
            {
                throw new Exception("Empty connect result payload");
            }

            Log.InfoFormat("Agent {0} connected to {1}:{2}", GetIdentifier(), _connectionInfo.Host, _connectionInfo.Port);

            var serverConfiguration = ServerConfiguration.FromDeserializedReturnValue(responseMap);

            LogConfigurationMessages(serverConfiguration);

            return(serverConfiguration);
        }
 public void unable_to_cast_throws_exception()
 {
     Assert.Throws(Is.InstanceOf <Exception>(), () => ServerConfiguration.FromDeserializedReturnValue(new Dictionary <string, object> {
         { "apdex_t", "hello" }
     }));
 }
 public void when_collection_is_empty_then_does_throw_exception()
 {
     Assert.Throws(Is.InstanceOf <Exception>(), () => ServerConfiguration.FromDeserializedReturnValue(new Dictionary <string, object>()));
 }
 public void string_when_double_expected_then_throws_exception()
 {
     Assert.Throws(Is.InstanceOf <Exception>(), () => ServerConfiguration.FromDeserializedReturnValue(new Dictionary <string, object> {
         { "agent_run_id", 0 }, { "apdex_t", "not a double" }
     }));
 }