private T PerformOperation <T>(string url, string specialName = null) { var answerString = _btceWebApi.RequestHttpInformation(url); T deserializedObject = _btceWebApi.Deserialize <T>(answerString, specialName); return(deserializedObject); }
public void Deserialize(bool successExpected) { // Arrange DtoFunds dummyDtoFunds = new DtoFunds { Btc = 1, Ltc = 2 }; string returnString = "\"return\": " + JsonConvert.SerializeObject(dummyDtoFunds); const string errorMessage = "\"error\": \"Error message\""; int successValue = successExpected ? 1 : 0; string message = successExpected ? returnString : errorMessage; string jsonString = "{ \"success\": " + successValue + ", " + message + " }"; // Act DtoFunds resultDto = _btceWebApi.Deserialize <DtoFunds>(jsonString); // Assert Assert.AreEqual(dummyDtoFunds, resultDto); }