public void TestApiOptionsAreSet() { // arrange, act var options = new TestClientOptions { Api1Options = new RestApiClientOptions { ApiCredentials = new ApiCredentials("123", "456"), BaseAddress = "http://test1.com" }, Api2Options = new RestApiClientOptions { ApiCredentials = new ApiCredentials("789", "101"), BaseAddress = "http://test2.com" } }; // assert Assert.AreEqual(options.Api1Options.ApiCredentials.Key.GetString(), "123"); Assert.AreEqual(options.Api1Options.ApiCredentials.Secret.GetString(), "456"); Assert.AreEqual(options.Api1Options.BaseAddress, "http://test1.com"); Assert.AreEqual(options.Api2Options.ApiCredentials.Key.GetString(), "789"); Assert.AreEqual(options.Api2Options.ApiCredentials.Secret.GetString(), "101"); Assert.AreEqual(options.Api2Options.BaseAddress, "http://test2.com"); }
public void TestSettingDefaultApiOptionsWithSomeOverriddenAreRespected() { // arrange TestClientOptions.Default = new TestClientOptions { ApiCredentials = new ApiCredentials("123", "456"), LogLevel = LogLevel.Trace, Api1Options = new RestApiClientOptions { ApiCredentials = new ApiCredentials("456", "789") }, Api2Options = new RestApiClientOptions { ApiCredentials = new ApiCredentials("111", "222") } }; // act var options = new TestClientOptions { Api1Options = new RestApiClientOptions { ApiCredentials = new ApiCredentials("333", "444") } }; // assert Assert.AreEqual(options.ApiCredentials.Key.GetString(), "123"); Assert.AreEqual(options.ApiCredentials.Secret.GetString(), "456"); Assert.AreEqual(options.Api1Options.ApiCredentials.Key.GetString(), "333"); Assert.AreEqual(options.Api1Options.ApiCredentials.Secret.GetString(), "444"); Assert.AreEqual(options.Api2Options.ApiCredentials.Key.GetString(), "111"); Assert.AreEqual(options.Api2Options.ApiCredentials.Secret.GetString(), "222"); }
public void TestBasicOptionsAreSet() { // arrange, act var options = new TestClientOptions { ApiCredentials = new ApiCredentials("123", "456"), ReceiveWindow = TimeSpan.FromSeconds(10) }; // assert Assert.AreEqual(options.ReceiveWindow, TimeSpan.FromSeconds(10)); Assert.AreEqual(options.ApiCredentials.Key.GetString(), "123"); Assert.AreEqual(options.ApiCredentials.Secret.GetString(), "456"); }
public void TestNotOverridenApiOptionsAreStillDefault() { // arrange, act var options = new TestClientOptions { Api1Options = new RestApiClientOptions { ApiCredentials = new ApiCredentials("123", "456"), } }; // assert Assert.AreEqual(options.Api1Options.RateLimitingBehaviour, RateLimitingBehaviour.Wait); Assert.AreEqual(options.Api1Options.BaseAddress, "https://api1.test.com/"); Assert.AreEqual(options.Api2Options.BaseAddress, "https://api2.test.com/"); }
public void TestSettingDefaultBaseOptionsAreRespected() { // arrange TestClientOptions.Default = new TestClientOptions { ApiCredentials = new ApiCredentials("123", "456"), LogLevel = LogLevel.Trace }; // act var options = new TestClientOptions(); // assert Assert.AreEqual(options.LogLevel, LogLevel.Trace); Assert.AreEqual(options.ApiCredentials.Key.GetString(), "123"); Assert.AreEqual(options.ApiCredentials.Secret.GetString(), "456"); }
public void TestSettingDefaultApiOptionsAreRespected() { // arrange TestClientOptions.Default = new TestClientOptions { ApiCredentials = new ApiCredentials("123", "456"), LogLevel = LogLevel.Trace, Api1Options = new RestApiClientOptions { ApiCredentials = new ApiCredentials("456", "789") } }; // act var options = new TestClientOptions(); // assert Assert.AreEqual(options.ApiCredentials.Key.GetString(), "123"); Assert.AreEqual(options.ApiCredentials.Secret.GetString(), "456"); Assert.AreEqual(options.Api1Options.BaseAddress, "https://api1.test.com/"); Assert.AreEqual(options.Api1Options.ApiCredentials.Key.GetString(), "456"); Assert.AreEqual(options.Api1Options.ApiCredentials.Secret.GetString(), "789"); }