{"id":21722301,"url":"https://github.com/ecoapm/benchmarkmocknet","last_synced_at":"2025-04-12T21:42:30.153Z","repository":{"id":38068146,"uuid":"85858203","full_name":"ecoAPM/BenchmarkMockNet","owner":"ecoAPM","description":"Using BenchmarkDotNet to compare .NET mocking library performance","archived":false,"fork":false,"pushed_at":"2025-04-07T13:29:04.000Z","size":189,"stargazers_count":22,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-12T21:42:25.654Z","etag":null,"topics":["benchmark","benchmarkdotnet","benchmarking","hacktoberfest","mock","mocking","testing"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ecoAPM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-22T17:41:29.000Z","updated_at":"2025-04-07T13:29:07.000Z","dependencies_parsed_at":"2024-01-05T21:27:34.928Z","dependency_job_id":"45dc807e-5c35-41d9-8235-da6fd35ac375","html_url":"https://github.com/ecoAPM/BenchmarkMockNet","commit_stats":{"total_commits":102,"total_committers":8,"mean_commits":12.75,"dds":"0.43137254901960786","last_synced_commit":"96a41f3fb60605281094d9ce3886ee5d5d92b5c8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecoAPM%2FBenchmarkMockNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecoAPM%2FBenchmarkMockNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecoAPM%2FBenchmarkMockNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecoAPM%2FBenchmarkMockNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecoAPM","download_url":"https://codeload.github.com/ecoAPM/BenchmarkMockNet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637833,"owners_count":21137538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","benchmarkdotnet","benchmarking","hacktoberfest","mock","mocking","testing"],"created_at":"2024-11-26T02:23:21.661Z","updated_at":"2025-04-12T21:42:30.133Z","avatar_url":"https://github.com/ecoAPM.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BenchmarkMockNet\n\nThis repo contains the code for, and results of, a series of performance benchmarks running against various .NET mocking libraries, using [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet).\n\n[![Results](https://img.shields.io/badge/Results-latest-darkgreen?logo=github)](https://github.com/ecoAPM/BenchmarkMockNet/blob/main/Results.md)\n[![CI](https://github.com/ecoAPM/BenchmarkMockNet/actions/workflows/CI.yml/badge.svg)](https://github.com/ecoAPM/BenchmarkMockNet/actions/workflows/CI.yml)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ecoAPM_BenchmarkMockNet\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=ecoAPM_BenchmarkMockNet)\n\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=ecoAPM_BenchmarkMockNet\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=ecoAPM_BenchmarkMockNet)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=ecoAPM_BenchmarkMockNet\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=ecoAPM_BenchmarkMockNet)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=ecoAPM_BenchmarkMockNet\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=ecoAPM_BenchmarkMockNet)\n\n## Current contenders (alphabetical order)\n\nThe baseline is a simple [stub class](BenchmarkMockNet/ThingStub.cs).\n\n- [FakeItEasy](https://fakeiteasy.github.io)\n- [JustMockLite](https://www.telerik.com/justmock/free-mocking)\n- [Moq](https://www.moqthis.com/moq4/)\n- [NSubstitute](http://nsubstitute.github.io/)\n- [PCLMock](https://github.com/kentcb/PCLMock)\n- [Rocks](https://github.com/JasonBock/Rocks)\n\nWant to add more? PRs welcome!\n- Add a method named after the framework to\n\t- `IMockingBenchmark`\n\t- `IMockingBenchmark\u003cT\u003e`\n\t- `MockingBenchmark`\n\t- `MockingBenchmark\u003cT\u003e`\n- Implement it in each of classes in the `Benchmarks` directory\n- Add a reference to it in `All.Frameworks`\n\n### A note about PCLMock\n\n`PCLMock` is a little different than the other libraries tested here, in that it requires explicitly generated mock classes. Compared against the other contenders, which use underlying parts of the framework like reflection to mock classes more \"on the fly\", `PCLMock` boasts improved performance over its more dynamic counterparts, at the cost of some additional effort during development time.\n\n## Tests\n\nThese tests cover standard mocking framework functionality\n\n| Test                                     | How long does it take...                           |\n| ---------------------------------------- | -------------------------------------------------- |\n| [Construction](Results.md#construction)  | for a mock to be created?                          |\n| [Return](Results.md#return)              | for a mocked method to return a value?             |\n| [EmptyReturn](Results.md#emptyreturn)    | for a mocked method to return default?             |\n| [EmptyMethod](Results.md#emptymethod)    | for a mocked method to be called?                  |\n| [OneParameter](Results.md#oneparameter)  | for a mocked method to be called with a parameter? |\n| [Callback](Results.md#callback)          | for a mocked method to perform a callback?         |\n| [Verify](Results.md#verify)              | for verification that a method was called?         |\n\nWant to add more? PRs welcome! Add a new class extending `MockingBenchmark` or `MockingBenchmark\u003cT\u003e`, depending on what you're testing, and a test case to `BenchmarkTests` with the relevant assertion.\n\n### Results\n\nLatest official results from the GitHub Actions workflow are available on the [Results](Results.md) page.\n\n## Building/Running from source\n\n### Requirements\n\n- .NET SDK\n\n### Installation\n\n1. Run `dotnet restore` to install all dependent libraries and prep for build\n1. Run `dotnet publish -c Release` to build the benchmarks (the `-c Release` flag is important to maximize accuracy)\n\n### Usage\n\n1. Once restored and built, run `dotnet bin/Release/net9.0/publish/BenchmarkMockNet.dll` to execute the benchmarks\n2. Benchmarks will take about 5 minutes to run\n3. Results are stored in the `BenchmarkDotNet.Artifacts` directory, in both HTML and Markdown formats\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecoapm%2Fbenchmarkmocknet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecoapm%2Fbenchmarkmocknet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecoapm%2Fbenchmarkmocknet/lists"}