abishekaditya / DesignPatterns

Project : Design Patterns Examples in C#
GNU General Public License v3.0
2.52k stars 617 forks source link

Unit tests for Singleton Pattern #24

Open chaurasia-amarjeet opened 3 years ago

chaurasia-amarjeet commented 3 years ago

We should include unit tests for patterns, Singleton pattern should be easiest to start with.

FunkyMonk8111 commented 1 year ago

Was this already implemented? I see SingletonPatternTests.cs

FunkyMonk8111 commented 1 year ago

I'm finding this is difficult to implement. Start using this example but couldn't quite get it to work as expected - http://pvlerick.github.io/2017/03/how-to-get-rid-of-a-singleton.

According to this article, TDD and ultimately unit testing isn't recommend - https://dev.to/bacarpereira/don-t-use-singleton-pattern-in-your-unit-tests-8p7