bluetech/pcsc-rust

How to mock a Card

Closed this issue · 3 comments

Hi, I am writing an application that uses pcsc and I have a struct that holds a Card. Some functions of this struct use card.transmit to send and receive APDUs and process them. I would like to be able to mock Card so that I can test these processing functions. What do you use for mocking Card?

It mostly depends, do you care about the actual APDUs/RAPDUs i.e. do you want to simulate the logic of an actual card, or do you just need some dummy for tests?

I only need a dummy for tests to begin with.

Edit: When I say dummy, for my use case it would be the best if I could choose what the transmit function returns, that way I could test the functions with test vectors.

Is not an issue. I fixed is as in the PR (Fethbita/emrtd#4) and as in the issue (Fethbita/emrtd#2) recommended by dishmaker.