public void DeserializeObject_ReturnsExpected_CommandResponse(string jsonResponse, CommandResponse expectedDeserializedResponse) { //Arrange AlpacaObjectDeserializer alpacaObjectDeserializer = new AlpacaObjectDeserializer(); //Act var response = alpacaObjectDeserializer.DeserializeObject <CommandResponse>(jsonResponse); //Assert Assert.Equal(expectedDeserializedResponse.ErrorMessage, response.ErrorMessage); Assert.Equal(expectedDeserializedResponse.ErrorNumber, response.ErrorNumber); Assert.Equal(expectedDeserializedResponse.ClientTransactionID, response.ClientTransactionID); Assert.Equal(expectedDeserializedResponse.ServerTransactionID, response.ServerTransactionID); }
public void ExecuteRequest_ReturnsExpectedResponse <TASCOMRemoteResponse>(string jsonResponse, TASCOMRemoteResponse expectedDeserializedResponse) where TASCOMRemoteResponse : IResponse { //Arrange AlpacaObjectDeserializer alpacaObjectDeserializer = new AlpacaObjectDeserializer(); //Act var response = alpacaObjectDeserializer.DeserializeObject <TASCOMRemoteResponse>(jsonResponse); //Assert Assert.Equal(expectedDeserializedResponse.ErrorMessage, response.ErrorMessage); Assert.Equal(expectedDeserializedResponse.ErrorNumber, response.ErrorNumber); Assert.Equal(expectedDeserializedResponse.ClientTransactionID, response.ClientTransactionID); Assert.Equal(expectedDeserializedResponse.ServerTransactionID, response.ServerTransactionID); var expectedValue = expectedDeserializedResponse.GetType().GetProperty("Value").GetValue(expectedDeserializedResponse, null); var responseValue = response.GetType().GetProperty("Value").GetValue(response, null); Assert.Equal(expectedValue, responseValue); }