public void Initialize_WithValidInputs_InitializesClusterHelper()
        {
            CouchbaseConfig config = new CouchbaseConfig();

            bool result = false;

            try
            {
                config.Initialize();

                result = Couchbase.ClusterHelper.Initialized;
            }
            catch
            {
                result = false;
            }

            Assert.IsTrue(result);
        }
        public void Initialize_WithValidInputs_ConfiguresCorrectly()
        {
            CouchbaseConfig config = new CouchbaseConfig();

            bool result = false;

            try
            {
                config.Initialize();

                result = config.AccountBucketName == FAKEACCOUNT &&
                         config.PortfolioBucketName == FAKEPORTFOLIO &&
                         config.UserBucketName == FAKEUSERS;
            }
            catch
            {
                result = false;
            }

            Assert.IsTrue(result);
        }
        public void Initialize_WithInvalidServerList_ThrowsConfigurationException()
        {
            Environment.SetEnvironmentVariable("COUCHBASE_SERVERS", string.Empty);
            CouchbaseConfig config = new CouchbaseConfig();

            bool result = false;

            try
            {
                config.Initialize();
            }
            catch (ConfigurationException)
            {
                result = true;
            }
            catch
            {
                result = false;
            }

            Assert.IsTrue(result);
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            CouchbaseConfig.Initialize();

            /* var config = new ClientConfiguration
             * {
             *   Servers = new List<Uri>
             *   {
             *       //change this to your cluster to bootstrap
             *      // new Uri("http://45.117.80.57/:8091/"),
             *
             *       new Uri("http://localhost/:8091/")
             *       }
             * };
             *
             * ClusterHelper.Initialize(config); */
        }
        public void Initialize_WithAllInvalidBuckets_ThrowsConfigurationException()
        {
            Environment.SetEnvironmentVariable("COUCHBASE_PORTFOLIO", string.Empty);
            Environment.SetEnvironmentVariable("COUCHBASE_ACCOUNT", string.Empty);
            Environment.SetEnvironmentVariable("COUCHBASE_USERS", string.Empty);
            CouchbaseConfig config = new CouchbaseConfig();

            bool result = false;

            try
            {
                config.Initialize();
            }
            catch (ConfigurationException)
            {
                result = true;
            }
            catch
            {
                result = false;
            }

            Assert.IsTrue(result);
        }