openactive / OpenActive.Server.NET

.NET server library, including an OpenActive Reference Implementation
MIT License
0 stars 7 forks source link

Make FakeDatabase more easy to replace #170

Open nickevansuk opened 2 years ago

nickevansuk commented 2 years ago

Reported issue:

We use strings for our Ids, meaning that when I tried to follow the "Configuring IBookableIdComponents" instruction in day 2 of the tutorial (https://tutorials.openactive.io/open-booking-sdk/quick-start-guide/storebookingengine/day-2-open-data-feeds#configuring-ibookableidcomponents), changing the ids from long? to string caused unfixable build errors. Which I fixed by going through and changing all the sigs etc on the OpenActive.FakeDatabase.Net from long to string. But might be better to have that whole setup generic in TId?

[I need to do that in order to follow the tutorial] ... day 1, get the test suite running with all test impls, day 2, implement the feeds properly, day 3 - 8, get the booking api working?

As it stands, on day 2, if I update the id types from long to string, it no longer builds, so either the instructions should start with "unplug the test impls and create stubs for your real impls", or there should be a generic version of the test impls so you can choose your id strategy up front I think?

Proposed solution:

Investigate whether FakeDatabase.NET could support both long and string IDs, to make it easier to partially implement without removing all the FakeDatabase.NET references in one go.

Also consider whether a "stub" based approach could be used after day 3-8, where the whole FakeDatabase is removed at once and replaced with stubs?