NikolayXHD / Mtgdb

Mtgdb.Gui - desktop app to search MTG cards and build decks
https://www.slightlymagic.net/forum/viewtopic.php?f=62&t=19299
Other
63 stars 10 forks source link

Add Support for TCG Player mobile app's CSV format #54

Closed AaronLS closed 3 years ago

AaronLS commented 4 years ago

TCG Player's card scanning mobile app let's you export your collection to a CSV file. Add support for import of the CSV file.

AaronLS commented 4 years ago

Working import: https://github.com/AaronLS/Mtgdb/commit/c8951f8c53a28a19e2b8d7af0159951e8596e66c

AaronLS commented 4 years ago

@NikolayXHD I take it Foils are not supported? The TCG player CSV breaks out cards by foils but looks like mtgdb gui doesn't support yet? Or am I not seeing where that is set?

NikolayXHD commented 4 years ago

Hi @AaronLS, you are right, foils are not supported. I have an issue #52, to support foils, not coming soon though, as it has great impact on application logic.

AaronLS commented 4 years ago

I was working on the unit test with two test artifacts embedded using: [TestCase(@"TestArtifacts\TcgCsvDeckFormatterInputTestCase.csv", @"TestArtifacts\Reference.json")]

This allows the test files to just sit in a folder under the test project so anyone can run the unit test without having specific paths setup. The two files would contain same cards, but in two different formats.

The test would deserialize the TCG CSV format using my new DeckFormatter, then deserialize the reference JSON using existing TcgParser.cs, then compare the resulting objects to verify both resulted in the same cards.

So the JSON acts as the reference set of cards to compare results against for consistency.

Technically this isn't a pure unit test, as it's exercising both the new deck formatter as well as TcgParser. Parsing JSON is pretty straightforward though, so I think if it as just a utility to load in a reference set of cards for comparison against.

If there were edge cases of problematic cards we wanted to add so the test is more thorough, it'd be a simple process to add them into the reference.json and CSV without making any code changes.

Is this approach fine with you?

NikolayXHD commented 4 years ago

Is this approach fine with you?

Absolutely

Technically this isn't a pure unit test

To me this is rather a good thing. I am of opinion that most errors happen between units of code, so less "unit" tests are more likely to help :) I wish I had end-to-end tests in Mtgdb.Gui to catch bugs in final application.