/// <summary>
        /// Runs the specified service.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <returns>a task</returns>
        private static async Task Run(Service service)
        {
            try
            {
                await service.GetConfigurationsAsync();
            }
            catch (AuthenticationFailureException e)
            {
                Console.WriteLine("Can't get service configuration without log in");
            }

            Console.WriteLine("Login as admin");
            string username = "******";
            string password = "******";
            await service.LoginAsync(username, password);

            Console.WriteLine("List all configurations of the Splunk service:");
            ConfigurationCollection configs = service.GetConfigurationsAsync().Result;
            foreach (Configuration config in configs)
            {
                Console.WriteLine(config.Id);
            }

            Console.WriteLine("Log off");
            await service.LogoffAsync();
        }
        public void ServiceLogin()
        {
            //ResponseMessage response;

            Service service = new Service(Scheme.Https, this.SetUp().Host, this.SetUp().Port);
            ConfigurationCollection config;

            // Not logged in, should fail with 401
            try
            {
                //response = service.Get("/services/authentication/users");
                config = service.GetConfigurationsAsync().Result;
                Assert.True(false, "Expected HttpException");
            }
            catch (WebException ex)
            {
                Assert.Equal(401, ((HttpWebResponse)ex.Response).StatusCode.GetHashCode());
            }
            catch (Exception e)
            {
                //TODO, if dev fix the aggregate exception issue, should only catch the above exception
                Assert.True(e.InnerException.Message.Contains("401"));
            }

            // Logged in, request should succeed
            service.LoginAsync(this.SetUp().Username, this.SetUp().Password).Wait();
            //response = service.Get("/services/authentication/users");
            //this.CheckResponse(response);
            config = service.GetConfigurationsAsync().Result;
            Assert.NotNull(config);

            //// Logout, the request should fail with a 401
            service.LogoffAsync().Wait();
            try
            {
                //response = service.Get("/services/authentication/users");
                config = service.GetConfigurationsAsync().Result;    
                Assert.True(false, "Expected HttpException");
            }
            catch (WebException ex)
            {
                Assert.Equal(401, ((HttpWebResponse)ex.Response).StatusCode.GetHashCode());
            }
            catch (Exception e)
            {
                //TODO, if dev fix the aggregate exception issue, should only catch the above exception
                Assert.True(e.InnerException.Message.Contains("401"));
            }
        }