public void ParseConfigFileCorrectlyTest()
        {
            SecureNativeOptions options = ConfigurationManager.LoadConfig();

            Assert.IsNotNull(options);
            Assert.AreEqual("SOME_API_KEY", options.GetApiKey());
            Assert.AreEqual("SOME_API_URL", options.GetApiUrl());
            Assert.AreEqual(true, options.IsAutoSend());
            Assert.AreEqual(false, options.IsDisabled());
            Assert.AreEqual(FailOverStrategy.FAIL_CLOSED, options.GetFailOverStrategy());
            Assert.AreEqual(1000, options.GetInterval());
            Assert.AreEqual("fatal", options.GetLogLevel());
            Assert.AreEqual(100, options.GetMaxEvents());
            Assert.AreEqual(1500, options.GetTimeout());
            Assert.AreEqual(1, options.GetProxyHeaders().Length);
        }
Exemplo n.º 2
0
        public Client(SecureNativeOptions options)
        {
            if (string.IsNullOrEmpty(options.GetApiKey()))
            {
                throw new SecureNativeSdkException("You must pass your SecureNative api key");
            }

            var eventManager = new EventManager(options);

            if (options.IsAutoSend())
            {
                eventManager.StartEventsPersist();
            }

            _apiManager = new ApiManager(eventManager, options);

            var logLevel = SecureNativeLogger.GetLogLevel(options.GetLogLevel());

            SecureNativeLogger.InitLogger(logLevel);
        }