7digital/SevenDigital.Api.Wrapper — pull request #50 by gregsochanik (2012-11-16 11:42:47+00:00)
Title: Simplify the Basket endpoints parameter call methods

This brings it more in-line with how the rest of the codebase behaves. Add/Remove item methods are replaced by a single UseBasketId method that takes a basketId in Guid format.

The RemoveItemFromBasket class now implements HasBasketItemParameter which hooks up the BasketItemId extension method to allow you to specify the basketItemItem you want to remove.

There are 2 known issues with this set-up though that I will look at:

As CreateBasket inherits from Basket, it also inherits the UseBasketId method which is irrelevant. Not a dangerous problem as the api ignores it, but more a clean code issue.

There are unit tests based around the idea that if you specify a track / release id with one instance of the FLuentApi, and then you use that instance to just spcify a releaseId; the trackId query string parameter should be removed. As a result of this, when you specify UseBasketId it fires api.ClearParameters(), which again from a clean code perspective is not ideal.

Example usage can be found in SevenDigital.Api.Wrapper.Integration.Tests.EndpointTests.BasketEndpoint.BasketCreateTests