{"id":29901033,"url":"https://github.com/sourceallies/beanoh.net","last_synced_at":"2026-03-07T18:01:34.237Z","repository":{"id":54781018,"uuid":"1855585","full_name":"sourceallies/beanoh.NET","owner":"sourceallies","description":".NET port for beanoh","archived":false,"fork":false,"pushed_at":"2021-01-29T19:50:49.000Z","size":91,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-11-27T14:22:25.109Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://beanoh.org","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sourceallies.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-06-06T16:39:49.000Z","updated_at":"2013-10-11T01:28:29.000Z","dependencies_parsed_at":"2022-08-14T02:50:30.142Z","dependency_job_id":null,"html_url":"https://github.com/sourceallies/beanoh.NET","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sourceallies/beanoh.NET","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourceallies%2Fbeanoh.NET","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourceallies%2Fbeanoh.NET/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourceallies%2Fbeanoh.NET/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourceallies%2Fbeanoh.NET/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sourceallies","download_url":"https://codeload.github.com/sourceallies/beanoh.NET/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourceallies%2Fbeanoh.NET/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30225409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T17:00:40.062Z","status":"ssl_error","status_checked_at":"2026-03-07T17:00:39.026Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-08-01T14:13:59.802Z","updated_at":"2026-03-07T18:01:34.189Z","avatar_url":"https://github.com/sourceallies.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Beanoh.NET, pronounced \\'beanˌō dot net\\ , is a simple open source way to verify you Spring.NET context. Teams that leverage Beanoh spend less time focusing on configuring Spring.NET and more time adding business value. \n\nFor licensing information refer to the license section. \n\n## Features\n1. Verify that all of your objects are wired correctly\n2. Prevent duplicate object definition overwriting\n\n## Dependencies\nBeanoh.NET is for verifying Spring.NET contexts, so naturally it depends on Spring.NET. More specifically, Spring.Core, Spring.Aop and Spring.Data. Moreover, it also depends on Castle.Core for proxying, Common.Logging for logging, Moq for mocking and more importantly NUnit as the implementation framework of the Beanoh.NET test fixtures. \n\nFor Licensing information of those dependencies : \n\n1. Castle.Core : Apache License V2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)\n2. Common.Logging : Apache License V2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)\n3. Moq : BSD License (http://opensource.org/licenses/bsd-license.php)\n4. NUnit : http://nunit.org/index.php?p=license\u0026r=2.5\n5. Spring.NET : Apache License V2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)\n\n## Writing Beanoh.NET Test Fixtures\nBeanoh.NET tries to follow a simple convention so that you will spend less time learning Beanoh.NET and more on gaining the feedback it provides. The convention in question is that your NUnit test fixture needs to extend the base `SourceAllies.Beanoh.BeanohTestCase` test fixture, and writing one Spring.NET bootstrap context that loads all the contexts you need to verify. That bootstrap context need to be in a certain location and named in a certain way for it to be picked up by Beanoh.NET. We will talk about those requirements shortly. \n\n\n### a. Assert Simple Context Loading\nFor example, let's say we want to verify a Spring.NET context found in `assembly://MyAssembly/My.Cute.Namespace/someSpringContext.xml` that defines objects and wire them together and it can possibly be loading other contexts in its turn. First we create a NUnit Test Fixture, let's call it `BasicWiringTest`, and it needs to extend `SourceAllies.Beanoh.BeanohTestCase` test fixture. \n\n    //Our Code will look like this \n    namespace My.Tests.Verbose.Namespace\n    {\n        [TestFixture]\n       public class BasicWiringTest : BeanohTestCase \n        {\n            [Test]\n            public void TestWiring()\n            {\n                AssertContextLoading();\n            }\n        }\n    }\n\n\nTo make a simple verification that every object definition in our Spring.NET context is being loaded, all we need is to define a test method `TestWiring()` that just calls `BeanohTestCase.AssertContextLoading()` method. \n\nNext, we need to define the bootstrap context that we were talking about earlier. For now all you need to know about is that it needs to satisfy the following criteria : \n1. It's to be named `X-BeanohContext.xml`. Where `X` is the name of your Test Fixture class, hence for our example the context name is `BasicWiringTest-BeanohContext.xml`.\n2. It needs to live in the same assembly as our test fixture. \n3. It needs to be in the same folder as our test fixture so that it will have the same namespace as the test fixture.\n4. It needs to be defined as an embedded resource so it will be copied along with our test fixture during compilation and execution. \n\n\n    \u003c!-- BasicWiringTest-BeanohContext.xml bootstrap context will be as follows --\u003e \n    \u003cobjects xmlns=\"http://www.springframework.net\"\u003e\n      \u003cimport resource=\"assembly://MyAssembly/My.Cute.Namespace/someSpringContext.xml\"/\u003e\n    \u003c/objects\u003e\n    \n\nNow, you can just run the test and let Beanoh.NET do its magic. \n\nSomething to point out is when the bootstrap conforms to these criteria, the effect will be that when you build your test assembly, you will find the test fixture class and the context living together in the same namespace in the generated DLL. Hence, if you have issues with running the test and you get a message saying couldn't find context, then your first troubleshooting task should be to inspect the tests assembly DLL and check that the bootstrap context and test fixture have the same namespace. You can inspect the DLL using tools like CodeReflect. \n\n**Note:** In future Beanoh.NET releases, we might add some flexibility around how to define the bootstrap context once we get a better understanding how Beanoh.NET users want that to be. \n\n\n### b. Assert No Duplicate Object Definitions\nAnother feature of Beanoh.NET is it can point out if you have duplicate object definitions where you are using the same object id for defining two or more objects. We all ran into situations where we are trying to troubleshoot a bug where one of our objects are not behaving like they should, and after a painful debugging session we find out that we pulled in some context that defined another object with the same id and that's the one being used by our program. \n\nNow Beanoh.NET, can detect by creating a test fixture and bootstrap context like we did in the previous example. The only difference is that our test method is calling `BeanohTestCase.AssertUniqueObjectContextLoading()`.\n\n    //our code will look like this \n    namespace SourceAllies.Beanoh.Duplicate\n    {\n        [TestFixture]\n        class DuplicateObjectTest : BeanohTestCase\n        {\n            [Test]\n            public void testDuplicates()\n            {\n               AssertUniqueObjectContextLoading();\n            }\n        }\n    }\n\n\n    \u003c!-- our DuplicateObjectTest-BeanohContext.xml bootstrap is as follows --\u003e\n    \u003cobjects xmlns=\"http://www.springframework.net\"\u003e\n         \u003c!-- load two contexts that might be defining duplicate object definitions --\u003e \n         \u003cimport resource=\"FirstDuplicate-context.xml\" /\u003e\n         \u003cimport resource=\"SecondDuplicate-context.xml\" /\u003e\n    \u003c/objects\u003e\n\nRun the test, and it will fail if it finds duplicates. \n\n### c. Ignore Certain Object Definitions While Checking for Duplication\nOf course, there are legitimate cases where intentionally want to override some object definitions. An example would be to replace one data source with another for testing purposes, or we want to discard an old object definition pulled from an old assembly that we cannot change and replace it with our own implementation. \n\nBeanoh.NET can take those cases into consideration very easily, all you need is to instruct your test fixture that you want to exclude the object ids in questions from the duplicate check as follow : \n\n    //our code will look like this \n    namespace SourceAllies.Beanoh.Duplicate\n    {\n        [TestFixture]\n        class IgnoreOneDuplicateObjectTest : BeanohTestCase\n        {\n            [Test]\n            public void testDuplicates()\n            {\n           \tIgnoreDuplicateObjectNames(\"person\");\n\t\t    AssertUniqueObjectContextLoading();\n            }\n        }\n    }\n\nThe previous code will have the effect of excluding any object definition with id of `person` from our check, but it will catch all other duplicates. Of course, don't forget to name your bootstrap context appropriately as `IgnoreOneDuplicateObjectTest-BeanohContext.xml`.\n\n### b. Override a IDbProvider During Verification\nBeanoh.NET provides a convenient method of overriding any `IDbProvider` object definitions that you might have in contexts. It could be the case, that you don't want to be connecting to your database during Beanoh.NET verifications. \n\nAll you need to do is to override that `IDbProvider` object definition with another one in the bootstrap context as follows (where \"DbProvider\" is the object id of the dbprovider we want to override and \"AbstractBeanohDbProvider\" is the id of the object definition provided by Beanoh.NET) : \n\n    \u003cobjects xmlns=\"http://www.springframework.net\"\u003e\n       \u003c!-- \n         This bootstrap context will load a context that requires a dbProvider which shouldn't be \n         used in our tests.  Beanoh.NET provides a convenience data source definition that can be \n         used to override such dependencies \n       --\u003e\n      \u003cimport resource=\"DbProviderDefinition-context.xml\"/\u003e\n      \u003cobject id=\"DbProvider\" parent=\"AbstractBeanohDbProvider\"/\u003e\n    \u003c/objects\u003e\n\n\nNow, you can run your tests even the `AssertUniqueObjectContextLoading()` calls without worrying that Beanoh.NET will say that \"DbProvider\" is duplicated because Beanoh.NET excludes objects defined in the bootstrap context. That's why we are restricting you to define only one bootstrap context and name it in a certain way so that Beanoh.NET can identify objects defined in it. \n\n## Displaying Beanoh.NET logs \nBeanoh.NET logs all pertaining messages using Common.Logging framework, for you to be able to see those log messages you need to add a reference to your favorite logging framework like log4net and also the appropriate connector framework that connects Common.Logging to your logging framework. In my case, it will be Common.Loggin.Log4Net. \n\nThen your app.config needs to include the following lines and define the log4net configuration in a separate file log4net.config : \n\n    \u003cconfiguration\u003e\n    \t.................. \n      \u003c!-- configuring Common.Logging logger --\u003e\n      \u003cconfigSections\u003e\n        \u003csectionGroup name=\"common\"\u003e\n          \u003csection name=\"logging\" type=\"Common.Logging.ConfigurationSectionHandler, Common.Logging\" /\u003e\n        \u003c/sectionGroup\u003e\n      \u003c/configSections\u003e\n      ................... \n       \u003c!-- connecting Common.Logging to log4net--\u003e\n      \u003ccommon\u003e\n        \u003clogging\u003e\n          \u003cfactoryAdapter type=\"Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net\"\u003e\n            \u003carg key=\"configType\" value=\"FILE-WATCH\" /\u003e\n            \u003carg key=\"configFile\" value=\"~/log4net.config\" /\u003e\n          \u003c/factoryAdapter\u003e\n        \u003c/logging\u003e\n      \u003c/common\u003e\n    \u003c/configuration\u003e\n\nFor more information on this, refer to Common.Logging documentation. \n\n## License\nCopyright (c) 2011  Source Allies\n\nThis library is free software; you can redistribute it and/or\nmodify it under the terms of the GNU Lesser General Public\nLicense as published by the Free Software Foundation version 3.0.\n\nThis library is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this library; if not, please visit \nhttp://www.gnu.org/licenses/lgpl-3.0.txt.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourceallies%2Fbeanoh.net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsourceallies%2Fbeanoh.net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourceallies%2Fbeanoh.net/lists"}