These assemblies contain the common code I have been writing ever since .NET 2! Not only do I use these assemblies in all my projects, but it is currently in production at the current company that I work for.
Below is the list of the assemblies that are being released today (more to come) and descriptions.
This assembly contains code that is used by all the other assemblies. Just some of the of what is contained are:
- Application information
- Common collection types
- Computer information
- Custom Exceptions
- Exception thrower
- Serialization: XML and JSON!
- Validator (Formerly Encapsulation): Validates method parameters and other validations.
- Web: ServiceProxy and Web helper methods
This assembly contains all the extension methods used by the assemblies. Over 39 classes so far! Here are some of the highlights:
- Collections: Array, Collection, Dictionary, Enumerable, HashSet, ImmutableArray, List, ObservableCollection, SortedDictionary, SortedSet
This assembly contains more higher-level code and/ or specific to Windows. I will be adding a lot more to this assembly, but this is what it contains so far:
- Collections: ConcurrentHashSet, DistinceConcurrentBag, FastSortedList, ObservableList, CollectionRandomizer and DistinctBlockingCollection
This assembly was converted from dotNetTips.Utility.Core.Tester for use in unit tests and benchmarking tests. The main class in this assembly is called RandomData that helps generate random data. Along with that, new types using the new record class types in .NET 5 along with methods to generate the data.
I have written about this assembly in this article: https://www.c-sharpcorner.com/article/unit-testing-with-random-data/
I use this assembly in ALL my unit tests and benchmark tests!
Since I now have many benchmarking test projects using BenchMarkDotnet, I decided to move the common code for these projects into this new assembly. The main classes are:
- Benchmark: Base class for all benchmark tests. This contains common info and sets a default configuration using attributes. For example, I configure all the export formats here and ordering.
- CounterBenchmark: This class features a counter used in most of the benchmark tests that allows the tests to run with multiple collection counts used to generate data. This class also pre-creates many of the collections used in testing.
- CollectionBenchmark: Class used for all the benchmark tests for collection types.
Now when I need to create a new benchmarking project and classes, this assembly makes it very easy and consistent!
I wanted to release these assemblies in January, then February but had to wait until now due to all the unit tests I have been writing or re-working. I wanted to have 75% coverage or better but am currently at 53%. I will continue to strive for 100% coverage for the new code while I fill in the rest.
If you would like to help with writing unit tests, please email me at email@example.com. Not only will you get your name listed as a contributor, which could help with job interviews, then I will send you dotNetTips.com swag! If you live in the United States, I will send you one of my books too (as supplies last).
One thing I have really, really wished worked for .NET 5 is IntelliTests since I could have had this work done a long time ago. If you want IntelliTests back in .NET 5, please vote by going here: https://developercommunity.visualstudio.com/idea/359250/add-intellitest-support-for-net-corestandard.html
Since I moved all the previous code to .NET 5, I decided to move a lot of the code into assemblies that make more sense and discoverable (except for extensions) along with changing method names and even parameters. Along with this, I have taken the time to write better documentation including sample code!
Due to this, if you used one of my older assemblies, you might run into breaking changes. I have tried to keep these to a minimum and in all the code I have had to change so far, most can be fixed with a simple search and replace.
If you run into major issues or cannot find something, please email me at firstname.lastname@example.org.
- Second Release: TBA
Looking for Contributors!
Do you have common code that you have written that you would like to contribute to this project? I am always looking for this type of code, so please download the source, make your improvements, and then submit a pull request!
If I accept it (make sure you follow the coding standards in my book), I will send you dotNetTips.com swag and if you live in the U.S., one of my books (while supplies last). I have a lot of swag sitting in my home due to not speaking in person for over a year!
To contribute, go to https://github.com/RealDotNetDave/dotNetTips.Spargine
I hope you will check out these assemblies. Stay tuned to this site for upcoming quarterly releases! If you have any comments or suggestions, please comment below. I am always looking for new ideas for these open-source projects!