public void CreateServiceBingConfigurationParameterConstructor_ValidConfiguration_ServiceCreated()
        {
            var bingConfiguration = BingConfiguration.CreateJsonOutputConfiguration("samplekey");
            var service           = new Mock <BingService>(bingConfiguration).Object;

            Assert.That(service, Is.Not.Null);
        }
Example #2
0
        public static BingConfiguration CreateJsonOutputConfiguration(string key)
        {
            var config = new BingConfiguration(key);

            config.OutputFormat = "json";
            config.Culture      = "en-US";

            return(config);
        }
        protected BingService(BingConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new BingConfigurationException(
                          "Invalid Bing configuration.",
                          new ArgumentNullException(
                              "configuration",
                              "Bing configuration object is required. Provide valid BingConfiguration object to instantiate the service."));
            }

            this.configuration = configuration;
        }
Example #4
0
        public static BingConfiguration CreateFromConfigurationSection(BingConfigurationSection section)
        {
            var config = new BingConfiguration(section.Key);

            config.BaseUrl         = section.BaseUrl;
            config.Version         = section.Version;
            config.Culture         = section.Culture;
            config.OutputFormat    = section.OutputFormat;
            config.ErrorDetail     = section.ErrorDetail;
            config.JsonpCallback   = section.JsonpCallback;
            config.JsonStateObject = section.JsonStateObject;
            config.SuppressStatus  = section.SuppressStatus;

            return(config);
        }
        protected BingService()
        {
            var configurationSection =
                (BingConfigurationSection)
                ConfigurationManager.GetSection(BingConfigurationSection.BingConfigurationSectionName);

            if (configurationSection == null)
            {
                throw new BingConfigurationException(
                          string.Format(
                              "Invalid Bing configuration. Insure you have '{0}' configuration sections defined in the application config file.",
                              BingConfigurationSection.BingConfigurationSectionName));
            }

            configuration = BingConfiguration.CreateFromConfigurationSection(configurationSection);
        }
 public BingLocations(BingConfiguration configuration)
     : base(configuration)
 {
 }
 public BingRoutes(BingConfiguration configuration)
     : base(configuration)
 {
 }
Example #8
0
 public BingSearcher()
 {
     Config = new BingConfiguration();
 }