pcsc-rust icon indicating copy to clipboard operation
pcsc-rust copied to clipboard

How to mock a Card

Open Fethbita opened this issue 1 year ago • 2 comments
trafficstars

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?

Fethbita avatar Apr 14 '24 09:04 Fethbita

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?

bluetech avatar Apr 18 '24 18:04 bluetech

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.

Fethbita avatar Apr 18 '24 18:04 Fethbita