Beispiel #1
0
        public void Scan(Action <ProfileScanner> scan)
        {
            Publish.ConfigurationEvent(() => "Scanning for profiles");
            var profileScanner = new ProfileScanner();

            scan.Invoke(profileScanner);
            var profiles = profileScanner.Scan().ToList();

            profiles.ForEach(ApplyProfile);
        }
        public void Should_locate_all_profiles()
        {
            // Arrange
            var scanner = new ProfileScanner();

            scanner.AssembliesFromApplicationBaseDirectory(assembly => assembly.FullName.StartsWith("FluentSecurity."));

            // Act
            scanner.LookForProfiles();

            // Assert
            var profiles = scanner.Scan();

            Assert.That(profiles.Count(), Is.EqualTo(3));
        }
        public void Should_not_locate_profiles_in_namespace()
        {
            // Arrange
            var scanner = new ProfileScanner();

            scanner.AssembliesFromApplicationBaseDirectory(assembly => assembly.FullName.StartsWith("FluentSecurity."));
            scanner.IncludeNamespaceContainingType <Level1Marker>();
            scanner.ExcludeNamespaceContainingType <Level2Marker>();

            // Act
            scanner.LookForProfiles();

            // Assert
            var profiles = scanner.Scan();

            Assert.That(profiles.Count(), Is.EqualTo(1));
            Assert.That(profiles.First(), Is.EqualTo(typeof(TestProfile1)));
        }