July 2019
Intermediate to advanced
410 pages
10h 32m
English
The ServiceProvider class provides a Services method that can be used to determine the appropriate service, when there are multiple dependencies registered for the same type. This example will take a different tack with InventoryCommands, and, because of the extent of the refactor, this will be done with new classes that will be created just to illustrate this approach.
In the unit test project, a new folder, ImplementationFactoryTests, was created, to contain the classes for this section. In the folder, a new base class for InventoryCommand was created:
public abstract class InventoryCommand{ protected abstract string[] CommandStrings { get; } public virtual bool IsCommandFor(string input) { return CommandStrings.Contains(input.ToLower()); ...Read now
Unlock full access