public void Should_throw_when_null()
        {
            // Arrange
            var context = new ScannerContext();

            // Act & Assert
            Assert.Throws<ArgumentNullException>(() => context.AddAssembly(null));
        }
        public void Should_throw_when_null()
        {
            // Arrange
            var context = new ScannerContext();

            // Act & Assert
            Assert.Throws<ArgumentNullException>(() => context.AddMatchOneFileFilter(null));
            Assert.Throws<ArgumentNullException>(() => context.AddMatchAllFileFilter(null));
        }
        public void Should_add_filter()
        {
            // Arrange
            var context = new ScannerContext();
            Func<Type, bool> filter = t => true;

            // Act
            context.AddFilter(filter);

            // Assert
            Assert.That(context.Filters.Single(), Is.EqualTo(filter));
        }
        public void Should_add_match_one_filter()
        {
            // Arrange
            var context = new ScannerContext();
            Func<string, bool> filter = t => true;

            // Act
            context.AddMatchOneFileFilter(filter);

            // Assert
            Assert.That(context.MatchOneFileFilters.Single(), Is.EqualTo(filter));
            Assert.That(context.MatchAllFileFilters.Any(), Is.False);
        }
        public void Should_only_add_unique_assemblies()
        {
            // Arrange
            var context = new ScannerContext();
            var assembly = GetType().Assembly;

            // Act
            context.AddAssembly(assembly);
            context.AddAssembly(assembly);

            // Assert
            Assert.That(context.AssembliesToScan.Single(), Is.EqualTo(assembly));
        }
Beispiel #6
0
 public AssemblyScanner()
 {
     Context = new ScannerContext();
 }
        public void Should_have_no_type_scanners()
        {
            // Act
            var context = new ScannerContext();

            // Assert
            Assert.That(context.TypeScanners.Count(), Is.EqualTo(0));
        }
        public void Should_have_no_filters()
        {
            // Act
            var context = new ScannerContext();

            // Assert
            Assert.That(context.MatchOneTypeFilters.Count(), Is.EqualTo(0));
            Assert.That(context.MatchAllTypeFilters.Count(), Is.EqualTo(0));
            Assert.That(context.MatchOneFileFilters.Count(), Is.EqualTo(0));
            Assert.That(context.MatchAllFileFilters.Count(), Is.EqualTo(0));
        }
        public void Should_have_no_assemblies_to_scan()
        {
            // Act
            var context = new ScannerContext();

            // Assert
            Assert.That(context.AssembliesToScan.Count(), Is.EqualTo(0));
        }
        public void Should_only_add_unique_type_scanners()
        {
            // Arrange
            var context = new ScannerContext();
            var typeScanner = new ProfileTypeScanner();

            // Act
            context.AddTypeScanner(typeScanner);
            context.AddTypeScanner(typeScanner);

            // Assert
            Assert.That(context.TypeScanners.Single(), Is.EqualTo(typeScanner));
        }