static DEVICE_REGISTRATION_STATE_HANDLE make_dummy_drs()
{
    expected_calls_deviceRegistrationState_fromJson();
    DEVICE_REGISTRATION_STATE_HANDLE drs = deviceRegistrationState_fromJson(TEST_JSON_OBJECT);
    umock_c_reset_all_calls();
    return drs;
}
static void run_and_verify_should_retry(RETRY_CONTROL_HANDLE handle, time_t first_retry_time, time_t last_retry_time, time_t current_time, double secs_since_first_retry, double secs_since_last_retry, RETRY_ACTION expected_retry_action, bool is_first_check)
{
    // arrange
    umock_c_reset_all_calls();
    if (is_first_check)
    {
        STRICT_EXPECTED_CALL(get_time(NULL)).SetReturn(current_time);
    }
    else
    {
        STRICT_EXPECTED_CALL(get_time(NULL)).SetReturn(current_time);
        STRICT_EXPECTED_CALL(get_difftime(current_time, first_retry_time)).SetReturn(secs_since_first_retry);

        if (expected_retry_action != RETRY_ACTION_STOP_RETRYING)
        {
            STRICT_EXPECTED_CALL(get_difftime(current_time, last_retry_time)).SetReturn(secs_since_last_retry);
        }
    }

    if (expected_retry_action == RETRY_ACTION_RETRY_NOW)
    {
        STRICT_EXPECTED_CALL(get_time(NULL)).SetReturn(current_time);
    }

    // act
    RETRY_ACTION retry_action;
    int result = retry_control_should_retry(handle, &retry_action);

    // assert
    ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
    ASSERT_ARE_EQUAL(int, 0, result);
    ASSERT_ARE_EQUAL(int, expected_retry_action, retry_action);
}
static RETRY_CONTROL_HANDLE create_retry_control(IOTHUB_CLIENT_RETRY_POLICY policy_name, unsigned int max_retry_time_in_secs)
{
    umock_c_reset_all_calls();
    EXPECTED_CALL(malloc(IGNORED_NUM_ARG));
    RETRY_CONTROL_HANDLE handle = retry_control_create(policy_name, max_retry_time_in_secs);

    return handle;
}