From 7827dfad4c3a21a52b2c907d063292b7d3ae7364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 27 Jul 2017 11:06:41 +0300 Subject: [PATCH] Created TypeFinder_Tests. --- .../Abp/Reflection/AssemblyFinder_Tests.cs | 2 +- .../Volo/Abp/Reflection/TypeFinder_Tests.cs | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 test/Volo.Abp.Tests/Volo/Abp/Reflection/TypeFinder_Tests.cs diff --git a/test/Volo.Abp.Tests/Volo/Abp/Reflection/AssemblyFinder_Tests.cs b/test/Volo.Abp.Tests/Volo/Abp/Reflection/AssemblyFinder_Tests.cs index 269e3a1cae..92cd5aaf64 100644 --- a/test/Volo.Abp.Tests/Volo/Abp/Reflection/AssemblyFinder_Tests.cs +++ b/test/Volo.Abp.Tests/Volo/Abp/Reflection/AssemblyFinder_Tests.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.Reflection [InlineData(new object[] { new Type[] { } })] [InlineData(new object[] { new[] { typeof(IndependentEmptyModule) } })] [InlineData(new object[] { new[] { typeof(AbpKernelModule), typeof(IndependentEmptyModule) } })] - public void Should_Get_Assemblies_Of_All_Modules(Type[] moduleTypes) + public void Should_Get_Assemblies_Of_Given_Modules(Type[] moduleTypes) { //Arrange diff --git a/test/Volo.Abp.Tests/Volo/Abp/Reflection/TypeFinder_Tests.cs b/test/Volo.Abp.Tests/Volo/Abp/Reflection/TypeFinder_Tests.cs new file mode 100644 index 0000000000..4bbaf34400 --- /dev/null +++ b/test/Volo.Abp.Tests/Volo/Abp/Reflection/TypeFinder_Tests.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.Extensions.Logging; +using NSubstitute; +using Shouldly; +using Xunit; + +namespace Volo.Abp.Reflection +{ + public class TypeFinder_Tests + { + [Fact] + public void Should_Find_Types_In_Given_Assemblies() + { + //Arrange + + var fakeAssemblyFinder = Substitute.For(); + fakeAssemblyFinder.Assemblies.Returns(new List + { + typeof(AbpKernelModule).GetAssembly(), + typeof(TypeFinder_Tests).GetAssembly() + }); + + //Act + + var typeFinder = new TypeFinder(fakeAssemblyFinder, Substitute.For>()); + + //Assert + + typeFinder.Types.ShouldContain(typeof(AbpKernelModule)); + typeFinder.Types.ShouldContain(typeof(TypeFinder_Tests)); + } + } +}