Hi, I has found that in test project of ABP, test class can access internal class of ABP, that really confused me. I create a test solution bu it didn't work work.
Is there any secret? :?: :?:
3 Answer(s)
-
0
Can you supply some code?
-
0
Well, here is a sample.
This is the test code,that in UnitOfWorkManager_Tests class of Abp.Tests projoect, at row 16 ~ 21:
LocalIocManager.IocContainer.Register( Component.For<IUnitOfWorkDefaultOptions>().ImplementedBy<UnitOfWorkDefaultOptions>().LifestyleSingleton(), Component.For<ICurrentUnitOfWorkProvider>().ImplementedBy<CallContextCurrentUnitOfWorkProvider>().LifestyleSingleton(), Component.For<IUnitOfWorkManager>().ImplementedBy<UnitOfWorkManager>().LifestyleSingleton(), Component.For<IUnitOfWork>().UsingFactoryMethod(() => fakeUow).LifestyleSingleton() );
but the UnitOfWorkDefaultOptions and UnitOfWorkManager live in Abp project, and is really internal class, such as :
internal class UnitOfWorkDefaultOptions : IUnitOfWorkDefaultOptions
internal class UnitOfWorkManager : IUnitOfWorkManager, ITransientDependency
May be I miss something?
-
0
Hi,
Yes, ABP unit tests access to internals of ABP. This is normal. Otherwise, how can I test internal classes of ABP? But you don't need to access it's internals since you're not testing ABP. Have you checked this article: <a class="postlink" href="http://www.codeproject.com/Articles/871786/Unit-testing-in-Csharp-using-xUnit-Entity-Framewor">http://www.codeproject.com/Articles/871 ... y-Framewor</a>