Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A demo for design patterns written in C# with Moq, Xunit and FluentAssertions

License

NotificationsYou must be signed in to change notification settings

deanagan/csharp-design-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NETCoverage Status

csharp-design-patterns

A bunch of demo codes for:

  1. GoF Design patterns written in C#
  2. Unit testing with Xunit
  3. Mocking with Moq
  4. Using FluentAssertions.
  5. Ninject is used for testing the demo on DI based singletons.

What Design Patterns can I find in this repository?

  • 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

How To Run the Demos

  1. Demos are divided into folders with the pattern.
  2. To build all, enterdotnet build
  3. To execute all the tests, enterdotnet test ordotnet test -l:"console;verbosity=detailed" to be more verbose.

TODOs

  1. Interpreter Pattern
  2. Unit of Work
  3. Repository Pattern
  4. CQRS with MediatR

Adding a Pattern

  1. Under Patterns folder, create a new directory with the new pattern name. Example:mkdir RepositoryPattern
  2. Change directory to new folder.
  3. 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.

Adding a package

  1. 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).
  2. Add the package: Example:dotnet add package FluentAssertions

About

A demo for design patterns written in C# with Moq, Xunit and FluentAssertions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp