Coding Sample is organized in 3 parts
A .NET Core Console project that does following
- Setting Configuration file Path and Getting Configuration back
- Dependency Registration of Services by registering ITarget
- Calling API to get response of "Hello World"
- Utilizing Factory Method Pattern to Get Target to display Greeting Message
- Factory Method Pattern has currently two implementations
Console
andDatabase
, In Future if requirements come to add to text file or something else, we can easily extend current factory to include more sources.
A .NET Core API project that does following
- Dependency Injection of IGreeting to HelloWorldGreeting
- Controller with one get endpoint that returns "Hello World"
MS test Project that has following unit tests
- API test - that asserts greeting message returned by controller method
- Facotry Creation Test - verifies factories getting created correctly based on parameter