public void MustSetExplicitAssemblies() { var asf = new Mock <List <Assembly> >(); var sut = new AssemblySourceFilter(New.Cqrs().AssemblyFilterSourceProvider.Creation, It.IsAny <string>(), asf.Object); Assert.Equal(asf.Object, sut.ExplictAssemblies); }
public void MustSetAssemblyProviderSource() { var asf = New.Cqrs().AssemblyFilterSourceProvider.Creation; var sut = new AssemblySourceFilter(asf, It.IsAny <string>(), It.IsAny <IEnumerable <Assembly> >()); Assert.Equal(asf, sut.AssemblySourceProvider); }
public void MustSetNamespaceSelector() { var asf = It.IsAny <string>(); var sut = new AssemblySourceFilter(New.Cqrs().AssemblyFilterSourceProvider.Creation, asf, It.IsAny <IEnumerable <Assembly> >()); Assert.Equal(asf, sut.NamespaceSelector); }
public void MustNotContainDuplicateAssemblies() { var assembly = New.Common().Assembly.Creation; var explicitAssemblies = new Assembly[] { assembly }; var assemblyFilterSourceProvider = New.Cqrs().AssemblyFilterSourceProvider.WithSourceAssemblies(assembly).Creation; var filter = new AssemblySourceFilter(assemblyFilterSourceProvider, string.Empty, explicitAssemblies); var result = filter.Apply(); result.Should().HaveCount(1); Assert.Contains(assembly, result); }
public void MustNotFilterAnyAssembliesWhenNamespaceSelectorIsEmptyAndNoExplicitAssemblies() { var assembly = New.Common().Assembly.Creation; var assemblyFilterSourceProvider = New.Cqrs().AssemblyFilterSourceProvider .WithSourceAssemblies(assembly) .Creation; var filter = new AssemblySourceFilter(assemblyFilterSourceProvider, string.Empty, null); var result = filter.Apply(); result.Should().HaveCount(1); result.Should().Contain(assembly); }
public void MustContainExplicitAssemblies() { var assembly = New.Common().Assembly.Creation; var explicitAssemblies = new Assembly[] { assembly }; var assemblyFilterSourceProvider = New.Cqrs().AssemblyFilterSourceProvider .Creation; var filter = new AssemblySourceFilter(assemblyFilterSourceProvider, string.Empty, explicitAssemblies); var result = filter.Apply(); Assert.Equal(explicitAssemblies, filter.ExplictAssemblies); Assert.Contains(assembly, result); }
public void MustNotFilterAnyAssembliesWhenNameselectorIsNullWithExplicitAssemblies() { var assembly = New.Common().Assembly.Creation; var assembly2 = New.Common().Assembly.Creation; var explicitAssemblies = new Assembly[] { assembly }; var assemblyFilterSourceProvider = New.Cqrs().AssemblyFilterSourceProvider .WithSourceAssemblies(assembly2) .Creation; var filter = new AssemblySourceFilter(assemblyFilterSourceProvider, null, explicitAssemblies); var result = filter.Apply(); result.Should().HaveCount(2); result.Should().Contain(assembly); result.Should().Contain(assembly2); }
public void MustMatchNamespaceSelectorWithSingleSymbolWildcardToAssemblyFullName() { var fullName = "Chatter.Cqrs"; var assembly = New.Common().Assembly .WithFullName(fullName) .Creation; var assemblyFilterSourceProvider = New.Cqrs().AssemblyFilterSourceProvider .WithSourceAssemblies(assembly) .Creation; var filter = new AssemblySourceFilter(assemblyFilterSourceProvider, "Chatter?Cqrs", null); var result = filter.Apply(); result.Should().HaveCount(1); result.First().FullName.Should().Be(fullName); result.First().Should().BeSameAs(assembly); }
public void MustIgnoreCaseWhenApplyingNamespaceSelectorFilterToAssemblyFullName() { var fullName = "Chatter.Cqrs"; var assembly = New.Common().Assembly .WithFullName(fullName) .Creation; var assemblyFilterSourceProvider = New.Cqrs().AssemblyFilterSourceProvider .WithSourceAssemblies(assembly) .Creation; var filter = new AssemblySourceFilter(assemblyFilterSourceProvider, fullName.ToUpper(), null); var result = filter.Apply(); result.Should().HaveCount(1); result.First().FullName.Should().Be(fullName); result.First().Should().BeSameAs(assembly); }
public void MustNotContainAssemblyThatDoesntMatchNamespaceSelector() { var @namespace = "This.is.a.Namespace"; var type = New.Common().Type .WithNamespace(@namespace) .Creation; var assembly = New.Common().Assembly .WithFullName(@namespace) .WithTypes(type) .Creation; var assemblyFilterSourceProvider = New.Cqrs().AssemblyFilterSourceProvider .WithSourceAssemblies(assembly) .Creation; var filter = new AssemblySourceFilter(assemblyFilterSourceProvider, "non-matching namespace filter", null); var result = filter.Apply(); result.Should().BeEmpty(); }
public void MustMatchNamespaceSelectorWithSingleSymbolWildcardToAssemblyTypeNamespaces() { var @namespace = "This.is.a.Namespace"; var type = New.Common().Type .WithNamespace(@namespace) .Creation; var assembly = New.Common().Assembly .WithTypes(type) .Creation; var assemblyFilterSourceProvider = New.Cqrs().AssemblyFilterSourceProvider .WithSourceAssemblies(assembly) .Creation; var filter = new AssemblySourceFilter(assemblyFilterSourceProvider, "Th?s.is.a?Namesp?ce", null); var result = filter.Apply(); result.Should().HaveCount(1); result.First().Should().BeSameAs(assembly); }
public void MustIgnoreCaseWhenApplyingNamespaceSelectorFilterToAssemblyTypeNamespaces() { var @namespace = "This.is.a.Namespace"; var type = New.Common().Type .WithNamespace(@namespace) .Creation; var assembly = New.Common().Assembly .WithTypes(type) .Creation; var assemblyFilterSourceProvider = New.Cqrs().AssemblyFilterSourceProvider .WithSourceAssemblies(assembly) .Creation; var filter = new AssemblySourceFilter(assemblyFilterSourceProvider, @namespace.ToUpper(), null); var result = filter.Apply(); result.Should().HaveCount(1); result.First().Should().BeSameAs(assembly); }
public void MustSetExplicitAssembliesToNewListOfAssembliesIfNull() { var sut = new AssemblySourceFilter(New.Cqrs().AssemblyFilterSourceProvider.Creation, It.IsAny <string>(), null); Assert.Equal(new List <Assembly>(), sut.ExplictAssemblies); }