A bunch of demo codes for:
- GoF Design patterns written in C#
- Unit testing with Xunit
- Mocking with Moq
- Using FluentAssertions.
- Ninject is used for testing the demo on DI based singletons.
- Patterns\AbstractFactory\AbstractFactory
- Patterns\Adapter\Adapter
- Patterns\Bridge\Bridge
- Patterns\Builder\Builder
- Patterns\ChainOfResponsibility\ChainOfResponsibility
- Patterns\Command\Command
- Patterns\Composite\Composite
- Patterns\Decorator\Decorator
- Patterns\Facade\Facade
- Patterns\FactoryMethod\FactoryMethod
- Patterns\Flyweight\Flyweight
- Patterns\Mediator\Mediator
- Patterns\Memento\Memento
- Patterns\Observer\Observer
- Patterns\Prototype\Prototype
- Patterns\Proxy\Proxy
- Patterns\SingletonDependencyInjection\SingletonDI
- Patterns\State\State
- Patterns\Strategy\Strategy
- Patterns\TemplateMethod\TemplateMethod
- Patterns\Visitor\Visitor
- Patterns\Iterator\Iterator
- Demos are divided into folders with the pattern.
- To build all, enter
dotnet build
- To execute all the tests, enter
dotnet test
ordotnet test -l:"console;verbosity=detailed"
to be more verbose.
- Interpreter Pattern
- Unit of Work
- Repository Pattern
- CQRS with MediatR
- Under Patterns folder, create a new directory with the new pattern name. Example:
mkdir RepositoryPattern
- Change directory to new folder.
- Create a new project. Example:
dotnet new classlib -n RepositoryPattern -o .
or justdotnet new webapi
if you like having the same project name as the current folder.
- Change directory to the pattern you want to add a package for or to the test folder (if you want to add a test package).
- Add the package: Example:
dotnet add package FluentAssertions