Пример #1
0
 public void test56_IsHelperUsefulFalse()
 {
     _device = new HdDevice();
     _store.SetPath("C://APIData");
     _headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36";
     var result = _device.IsHelperUseful(_headers);
     Assert.IsFalse(result);
 }
Пример #2
0
        public void test55_IsHelperUsefulTrue()
        {
            _device = new HdDevice();
            _store.SetPath("C://APIData");

            var result = _device.IsHelperUseful(_headers);
            Assert.IsTrue(result);
        }
Пример #3
0
        public void test56_IsHelperUsefulFalse()
        {
            _device = new HdDevice();
            _store.SetPath("C://APIData");
            _headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36";
            var result = _device.IsHelperUseful(_headers);

            Assert.IsFalse(result);
        }
Пример #4
0
        public void test55_IsHelperUsefulTrue()
        {
            _device = new HdDevice();
            _store.SetPath("C://APIData");

            var result = _device.IsHelperUseful(_headers);

            Assert.IsTrue(result);
        }
Пример #5
0
        /// <summary>
        /// This is the main constructor for the class HD4
        /// </summary>
        /// <param name="request">Curret Request Object</param>
        /// <param name="configuration">config can be an array of config options or a fully qualified path to an alternate config file.</param>
        public Hd4(HttpRequest request, dynamic configuration = null)
        {
            _request = request;
            if (configuration != null && configuration is IDictionary)
            {
                foreach (KeyValuePair <string, string> item in (Dictionary <string, string>)configuration)
                {
                    if (Config.ContainsKey(item.Key))
                    {
                        Config[item.Key] = item.Value;
                    }
                    else
                    {
                        Config.Add(item.Key, item.Value);
                    }
                }
            }
            else if (configuration != null && configuration is string && File.Exists(ApplicationRootDirectory + configuration))
            {
                AddConfigSettingFromFile(ApplicationRootDirectory + configuration);
            }
            else if (!File.Exists(ApplicationRootDirectory + _configFile))
            {
                throw new Exception("Error : Invalid config file and no config passed to constructor");
            }
            else
            {
                AddConfigSettingFromFile(ApplicationRootDirectory + _configFile);
            }

            _store = HdStore.Instance;
            _store.SetPath(Config["filesdir"], true);

            _cache  = new HdCache();
            _device = new HdDevice();

            Setup();
        }
Пример #6
0
        /// <summary>
        /// This is the main constructor for the class HD4
        /// </summary>
        /// <param name="request">Curret Request Object</param>
        /// <param name="configuration">config can be an array of config options or a fully qualified path to an alternate config file.</param>
        public Hd4(HttpRequest request, dynamic configuration = null)
        {
            _request = request;
            if (configuration != null && configuration is IDictionary)
            {
                foreach (KeyValuePair<string, string> item in (Dictionary<string, string>)configuration)
                {
                    if (Config.ContainsKey(item.Key))
                    {
                        Config[item.Key] = item.Value;
                    }
                    else
                    {
                        Config.Add(item.Key, item.Value);
                    }
                }
            }
            else if (configuration != null && configuration is string && File.Exists(ApplicationRootDirectory + configuration))
            {
                AddConfigSettingFromFile(ApplicationRootDirectory + configuration);
            }
            else if (!File.Exists(ApplicationRootDirectory + _configFile))
            {
                throw new Exception("Error : Invalid config file and no config passed to constructor");
            }
            else
            {
                AddConfigSettingFromFile(ApplicationRootDirectory + _configFile);
            }

            _store = HdStore.Instance;
            _store.SetPath(Config["filesdir"], true);

            _cache = new HdCache();
            _device = new HdDevice();

            Setup();
        }