Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
        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);
        }
Пример #9
0
        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);
        }
Пример #10
0
        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();
        }
Пример #11
0
        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);
        }
Пример #12
0
        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);
        }
Пример #13
0
        public void MustSetExplicitAssembliesToNewListOfAssembliesIfNull()
        {
            var sut = new AssemblySourceFilter(New.Cqrs().AssemblyFilterSourceProvider.Creation, It.IsAny <string>(), null);

            Assert.Equal(new List <Assembly>(), sut.ExplictAssemblies);
        }