示例#1
0
        private T PerformOperation <T>(Dictionary <string, string> operations)
        {
            var jsonString         = _btceWebApi.GetAnswerAsJsonString(operations, "https://btc-e.com/tapi");
            var deserializedObject = _btceWebApi.Deserialize <T>(jsonString);

            return(deserializedObject);
        }
示例#2
0
        public void GetAnswerAsJsonString(string key, string secret, string apiUri)
        {
            // Arrange
            var operations = new Dictionary <string, string>
            {
                { "method", "dummyOperation" }
            };

            // Act
            var    webApi     = new BTCEWebApi(key, secret);
            string jsonString = webApi.GetAnswerAsJsonString(operations, apiUri);

            // Assert
            if (apiUri == "http://www.invalid.test")
            {
                Assert.IsFalse(jsonString.Contains("success"));
            }
            else
            {
                Assert.IsTrue(jsonString.Contains("success"));
            }

            // This must be ensured because each operation can only use one nonce a nonce can only be generated every one second
            // due to its UnixTime nature.
            Thread.Sleep(1000);
        }