Represents a set of configuration settings
		public void TestConstructor()
		{
			Configuration c = new Configuration (username: "******", password: "******");
			Assert.AreEqual (c.Username, "test username");
			Assert.AreEqual (c.Password, "test password");

		}
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiClient" /> class
        /// with default base path (http://api.cloudboost.io/).
        /// </summary>
        /// <param name="config">An instance of Configuration.</param>
        public ApiClient(Configuration config = null)
        {
            if (config == null)
                Configuration = Configuration.Default;
            else
                Configuration = config;

            RestClient = new RestClient("http://api.cloudboost.io/");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiClient" /> class
        /// with default base path (https://petstore.swagger.io *_/ ' \" =end - - \\r\\n \\n \\r/v2 *_/ ' \" =end - - \\r\\n \\n \\r).
        /// </summary>
        /// <param name="config">An instance of Configuration.</param>
        public ApiClient(Configuration config = null)
        {
            if (config == null)
                Configuration = Configuration.Default;
            else
                Configuration = config;

            RestClient = new RestClient("https://petstore.swagger.io *_/ ' \" =end - - \\r\\n \\n \\r/v2 *_/ ' \" =end - - \\r\\n \\n \\r");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiClient" /> class
        /// with default base path (https://petstore.swagger.io  ' \" =end/v2  ' \" =end).
        /// </summary>
        /// <param name="config">An instance of Configuration.</param>
        public ApiClient(Configuration config = null)
        {
            if (config == null)
                Configuration = Configuration.Default;
            else
                Configuration = config;

            RestClient = new RestClient("https://petstore.swagger.io  ' \" =end/v2  ' \" =end");
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiClient" /> class
        /// with default base path (https://www.callcontrol.com).
        /// </summary>
        /// <param name="config">An instance of Configuration.</param>
        public ApiClient(Configuration config = null)
        {
            if (config == null)
                Configuration = Configuration.Default;
            else
                Configuration = config;

            RestClient = new RestClient("https://www.callcontrol.com");
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiClient" /> class
        /// with default base path (https://localhost/api/v1).
        /// </summary>
        /// <param name="config">An instance of Configuration.</param>
        public ApiClient(Configuration config = null)
        {
            if (config == null)
                Configuration = Configuration.Default;
            else
                Configuration = config;

            RestClient = new RestClient("https://localhost/api/v1");
        }
Exemplo n.º 7
0
        public void TestAddPetUsingByteArray()
        {
            // set timeout to 10 seconds
            Configuration c1 = new Configuration (timeout: 10000);

            PetApi petApi = new PetApi (c1);
            Pet p = createPet ();
            byte[] petByteArray = GetBytes ((string)petApi.Configuration.ApiClient.Serialize (p));
            petApi.AddPetUsingByteArray (petByteArray);
        }
Exemplo n.º 8
0
        public void TestAuthentication()
        {
            Configuration c = new Configuration ();
            c.Username = "******";
            c.Password = "******";

            c.ApiKey ["api_key_identifier"] = "1233456778889900";
            c.ApiKeyPrefix ["api_key_identifier"] = "PREFIX";
            Assert.AreEqual (c.GetApiKeyWithPrefix("api_key_identifier"), "PREFIX 1233456778889900");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ModelFlowChartValidationApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public ModelFlowChartValidationApi(IO.Swagger.Client.Configuration configuration = null)
        {
            if (configuration == null) // use the default one in Configuration
            {
                this.Configuration = IO.Swagger.Client.Configuration.Default;
            }
            else
            {
                this.Configuration = configuration;
            }

            ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
        }
Exemplo n.º 10
0
        public void TestGetInventory()
        {
            // set timeout to 10 seconds
            Configuration c1 = new Configuration (timeout: 10000);

            StoreApi storeApi = new StoreApi (c1);
            Dictionary<String, int?> response = storeApi.GetInventory ();

            foreach(KeyValuePair<string, int?> entry in response)
            {
                Assert.IsInstanceOf (typeof(int?), entry.Value);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public FakeClassnameTags123Api(IO.Swagger.Client.Configuration configuration = null)
        {
            if (configuration == null) // use the default one in Configuration
            {
                this.Configuration = IO.Swagger.Client.Configuration.Default;
            }
            else
            {
                this.Configuration = configuration;
            }

            ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
        }
Exemplo n.º 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreditsApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public CreditsApi(IO.Swagger.Client.Configuration configuration = null)
        {
            if (configuration == null) // use the default one in Configuration
            {
                this.Configuration = IO.Swagger.Client.Configuration.Default;
            }
            else
            {
                this.Configuration = configuration;
            }

            ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReceptionInvoicesManagementApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public ReceptionInvoicesManagementApi(IO.Swagger.Client.Configuration configuration = null)
        {
            if (configuration == null) // use the default one in Configuration
            {
                this.Configuration = IO.Swagger.Client.Configuration.Default;
            }
            else
            {
                this.Configuration = configuration;
            }

            ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HealthCheckControllerApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public HealthCheckControllerApi(IO.Swagger.Client.Configuration configuration = null)
        {
            if (configuration == null) // use the default one in Configuration
            {
                this.Configuration = IO.Swagger.Client.Configuration.Default;
            }
            else
            {
                this.Configuration = configuration;
            }

            ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessProfessionalRoleApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public ProcessProfessionalRoleApi(IO.Swagger.Client.Configuration configuration = null)
        {
            if (configuration == null) // use the default one in Configuration
            {
                this.Configuration = IO.Swagger.Client.Configuration.Default;
            }
            else
            {
                this.Configuration = configuration;
            }

            ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
        }
        private void ConfigureFromSettings()
        {
            //IL_0035: Unknown result type (might be due to invalid IL or missing references)
            //IL_003f: Expected O, but got Unknown
            string valueFromAppSettings  = AppSettingsHelper.GetValueFromAppSettings("DpvClassLibrary.Receivers.DataPackageEnvelopeAwsReceiver.BasePath");
            string valueFromAppSettings2 = AppSettingsHelper.GetValueFromAppSettings("apikey");

            Configuration = new IO.Swagger.Client.Configuration((IDictionary <string, string>) new Dictionary <string, string>
            {
                {
                    "x-api-key",
                    valueFromAppSettings2
                }
            }, (IDictionary <string, string>) new Dictionary <string, string>(), (IDictionary <string, string>) new Dictionary <string, string>(), valueFromAppSettings);
        }
Exemplo n.º 17
0
        public void TestGetInventoryInObject()
        {
            // set timeout to 10 seconds
            Configuration c1 = new Configuration (timeout: 10000);

            StoreApi storeApi = new StoreApi (c1);
            Newtonsoft.Json.Linq.JObject response = (Newtonsoft.Json.Linq.JObject)storeApi.GetInventoryInObject ();

            // should be a Newtonsoft.Json.Linq.JObject since type is object
            Assert.IsInstanceOf (typeof(Newtonsoft.Json.Linq.JObject), response);

            foreach(KeyValuePair<string, string> entry in response.ToObject<Dictionary<string, string>>())
            {
                Assert.IsInstanceOf (typeof(int?), Int32.Parse(entry.Value));
            }
        }
Exemplo n.º 18
0
        public void TestDefautlConfiguration()
        {
            PetApi p1 = new PetApi ();
            PetApi p2 = new PetApi ();
            Assert.AreSame (p1.Configuration, p2.Configuration);
            // same as the default
            Assert.AreSame (p1.Configuration, Configuration.Default);

            Configuration c = new Configuration ();
            Assert.AreNotSame (c, p1.Configuration);

            PetApi p3 = new PetApi (c);
            // same as c
            Assert.AreSame (p3.Configuration, c);
            // not same as default
            Assert.AreNotSame (p3.Configuration, p1.Configuration);
        }
Exemplo n.º 19
0
        public void GetInventoryTest()
        {
            // TODO: add unit test for the method 'GetInventory'
            //var response = instance.GetInventory();
            //Assert.IsInstanceOf<Dictionary<string, int?>> (response, "response is Dictionary<string, int?>");

            // set timeout to 10 seconds
            Configuration c1 = new Configuration (timeout: 10000);

            StoreApi storeApi = new StoreApi (c1);
            Dictionary<String, int?> response = storeApi.GetInventory ();

            foreach(KeyValuePair<string, int?> entry in response)
            {
                Assert.IsInstanceOf (typeof(int?), entry.Value);
            }
        }
Exemplo n.º 20
0
        public SDKTest()
        {
            var apiKey = new Dictionary <string, string>()
            {
                { "AppSecret", ConfigurationManager.AppSettings["AppSecret"] },
                { "AppId", ConfigurationManager.AppSettings["AppId"] }
            };

            _config           = new Configuration(apiKey: apiKey);
            _config.ApiClient = new ApiClient(_config);

            if (!Directory.Exists(ConfigurationManager.AppSettings["SourcePath"]))
            {
                Directory.CreateDirectory(ConfigurationManager.AppSettings["SourcePath"]);
            }

            if (!Directory.Exists(ConfigurationManager.AppSettings["SourcePath"] + "metrics/"))
            {
                Directory.CreateDirectory(ConfigurationManager.AppSettings["SourcePath"] + "metrics/");
            }
        }
Exemplo n.º 21
0
        public void TestGetPetByIdWithByteArray()
        {
            // set timeout to 10 seconds
            Configuration c1 = new Configuration (timeout: 10000);

            PetApi petApi = new PetApi (c1);
            byte[] response = petApi.PetPetIdtestingByteArraytrueGet (petId);
            Assert.IsInstanceOf<byte[]> (response, "Response is byte array");
        }
Exemplo n.º 22
0
		public void TestTimeout ()
		{
			Configuration c1 = new Configuration();
			Assert.AreEqual(100000, c1.Timeout); // default vaue

			c1.Timeout = 50000;
			Assert.AreEqual(50000, c1.Timeout);

			Configuration c2 = new Configuration(timeout: 20000);
			Assert.AreEqual(20000, c2.Timeout);
		}
Exemplo n.º 23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CloudCacheApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public CloudCacheApi(Configuration configuration = null)
        {
            if (configuration == null) // use the default one in Configuration
                this.Configuration = Configuration.Default; 
            else
                this.Configuration = configuration;

            // ensure API client has configuration ready
            if (Configuration.ApiClient.Configuration == null)
            {
                this.Configuration.ApiClient.Configuration = this.Configuration;
            }
        }
Exemplo n.º 24
0
        public void TestGetPetById()
        {
            // set timeout to 10 seconds
            Configuration c1 = new Configuration (timeout: 10000);

            PetApi petApi = new PetApi (c1);
            Pet response = petApi.GetPetById (petId);
            Assert.IsInstanceOf<Pet> (response, "Response is a Pet");

            Assert.AreEqual ("Csharp test", response.Name);
            Assert.AreEqual ("available", response.Status);

            Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array");
            Assert.AreEqual (petId, response.Tags [0].Id);
            Assert.AreEqual ("sample tag name1", response.Tags [0].Name);

            Assert.IsInstanceOf<List<String>> (response.PhotoUrls, "Response.PhotoUrls is a Array");
            Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);

            Assert.IsInstanceOf<Category> (response.Category, "Response.Category is a Category");
            Assert.AreEqual (56, response.Category.Id);
            Assert.AreEqual ("sample category name2", response.Category.Name);
        }
Exemplo n.º 25
0
        public void TestGetPetByIdInObject()
        {
            // set timeout to 10 seconds
            Configuration c1 = new Configuration (timeout: 10000);

            PetApi petApi = new PetApi (c1);
            InlineResponse200 response = petApi.GetPetByIdInObject (petId);
            Assert.IsInstanceOf<InlineResponse200> (response, "Response is a Pet");

            Assert.AreEqual ("Csharp test", response.Name);
            Assert.AreEqual (InlineResponse200.StatusEnum.Available, response.Status);

            Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array");
            Assert.AreEqual (petId, response.Tags [0].Id);
            Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);

            Assert.IsInstanceOf<List<String>> (response.PhotoUrls, "Response.PhotoUrls is a Array");
            Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);

            Assert.IsInstanceOf<Newtonsoft.Json.Linq.JObject> (response.Category, "Response.Category is a Newtonsoft.Json.Linq.JObject");

            Newtonsoft.Json.Linq.JObject category = (Newtonsoft.Json.Linq.JObject)response.Category;
            Assert.AreEqual (56, (int)category ["id"]);
            Assert.AreEqual ("sample category name2", (string) category["name"]);
        }
Exemplo n.º 26
0
		public void TestApiClientInstance ()
		{
			PetApi p1 = new PetApi ();
			PetApi p2 = new PetApi ();

			Configuration c1 = new Configuration (); // using default ApiClient
			PetApi p3 = new PetApi (c1);

			ApiClient a1 = new ApiClient();
			Configuration c2 = new Configuration (a1); // using "a1" as the ApiClient
			PetApi p4 = new PetApi (c2);


			// ensure both using the same default ApiClient
			Assert.AreSame(p1.Configuration.ApiClient, p2.Configuration.ApiClient);
			Assert.AreSame(p1.Configuration.ApiClient, Configuration.Default.ApiClient);

			// ensure both using the same default ApiClient
			Assert.AreSame(p3.Configuration.ApiClient, c1.ApiClient);
			Assert.AreSame(p3.Configuration.ApiClient, Configuration.Default.ApiClient);

			// ensure it's not using the default ApiClient
			Assert.AreSame(p4.Configuration.ApiClient, c2.ApiClient);
			Assert.AreNotSame(p4.Configuration.ApiClient, Configuration.Default.ApiClient);

		}
Exemplo n.º 27
0
		public void TestUsage ()
		{
			// basic use case using default base URL
			PetApi p1 = new PetApi (); 
			Assert.AreSame (p1.Configuration, Configuration.Default, "PetApi should use default configuration");

			// using a different base URL
			PetApi p2 = new PetApi ("http://new-base-url.com/");
			Assert.AreEqual (p2.Configuration.ApiClient.RestClient.BaseUrl.ToString(), "http://new-base-url.com/");

			// using a different configuration
			Configuration c1 = new Configuration ();
			PetApi p3 = new PetApi (c1);
			Assert.AreSame (p3.Configuration, c1);

			// using a different base URL via a new ApiClient
			ApiClient a1 = new ApiClient ("http://new-api-client.com");
			Configuration c2 = new Configuration (a1);
			PetApi p4 = new PetApi (c2);
			Assert.AreSame (p4.Configuration.ApiClient, a1);
		}
 public DataPackageEnvelopeAwsReceiver(IO.Swagger.Client.Configuration configuration)
 {
     Configuration = configuration;
 }
Exemplo n.º 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StoreApi"/> class
 /// using Configuration object
 /// </summary>
 /// <param name="configuration">An instance of Configuration</param>
 /// <returns></returns>
 public StoreApi(Configuration configuration = null)
 {
     if (configuration == null) // use the default one in Configuration
         this.Configuration = Configuration.Default; 
     else
         this.Configuration = configuration;
 }
Exemplo n.º 30
0
        public void GetPetByIdTest()
        {
			// set timeout to 10 seconds
			Configuration c1 = new Configuration (timeout: 10000, userAgent: "TEST_USER_AGENT");

			PetApi petApi = new PetApi (c1);
			Pet response = petApi.GetPetById (petId);
			Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");

			Assert.AreEqual ("Csharp test", response.Name);
			Assert.AreEqual (Pet.StatusEnum.Available, response.Status);

			Assert.IsInstanceOfType(typeof(List<Tag>), response.Tags, "Response.Tags is a Array");
			Assert.AreEqual (petId, response.Tags [0].Id);
			Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);

			Assert.IsInstanceOfType(typeof(List<String>), response.PhotoUrls, "Response.PhotoUrls is a Array");
			Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);

			Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
			Assert.AreEqual (56, response.Category.Id);
			Assert.AreEqual ("sample category name2", response.Category.Name);
        }
Exemplo n.º 31
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LeaderboardApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public LeaderboardApi(Configuration configuration = null)
        {
            if (configuration == null) // use the default one in Configuration
                this.Configuration = Configuration.Default;
            else
                this.Configuration = configuration;

            ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;

            // ensure API client has configuration ready
            if (Configuration.ApiClient.Configuration == null)
            {
                this.Configuration.ApiClient.Configuration = this.Configuration;
            }
        }
Exemplo n.º 32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiClient" /> class
        /// with default base path (https://www.strava.com/api/v3).
        /// </summary>
        /// <param name="config">An instance of Configuration.</param>
        public ApiClient(Configuration config)
        {
            Configuration = config ?? IO.Swagger.Client.Configuration.Default;

            RestClient = new RestClient(Configuration.BasePath);
        }