Esempio n. 1
0
        public void ConstructWithParametersAssemblyNameInputAssembliesTest()
        {
            this.testObject = new AssemblyFetcher(this.methodVisibility, "Some other root", this.inputAssemblies);

            Assert.Throws <ArgumentNullException>(() => new AssemblyFetcher(this.methodVisibility, null, this.inputAssemblies));
            Assert.Throws <ArgumentException>(() => new AssemblyFetcher(this.methodVisibility, string.Empty, this.inputAssemblies));
            Assert.Throws <ArgumentNullException>(() => new AssemblyFetcher(this.methodVisibility, this.assemblyName, null));
        }
Esempio n. 2
0
        protected override void Load(ContainerBuilder builder)
        {
            Assembly[] assemblies = AssemblyFetcher.GetAssemblies().ToArray();

            builder.RegisterAssemblyTypes(assemblies)
            .Where(type => type.IsConcretePublicClassImplementing <ITool>())
            .AsImplementedInterfaces();
        }
Esempio n. 3
0
        public void LoadAssemblyWithDifferentDescription()
        {
            var expectedRootName = "Different Name";

            this.testObject = new AssemblyFetcher(this.methodVisibility, expectedRootName, this.inputAssemblies);
            var result = testObject.LoadAssembly();

            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result.Nodes);
            Assert.AreEqual(expectedRootName, result.Text);
        }
Esempio n. 4
0
        /// <summary>
        /// Reflects through the currently selected assembly and reflects the type tree
        /// in tvAssemblyGraph.
        /// </summary>
        private void LoadAssembly()
        {
            var asf = new AssemblyFetcher(
                MemberVisibility.Internal,
                this._inputAssemblyOpenFileDialog.FileName,
                this._inputAssemblyOpenFileDialog.FileNames);

            var resss = asf.LoadAssembly();

            this._assemblyGraphTreeView.Nodes.Clear();
            this._assemblyGraphTreeView.Nodes.Add(resss.Nodes[0].MapToTree());
        }
Esempio n. 5
0
        public static Task <IContainer> StartAsync()
        {
            var builder = new ContainerBuilder();

            Assembly[] assemblies = AssemblyFetcher.GetAssemblies().ToArray();

            builder.RegisterAssemblyModules(assemblies);

            IContainer container = builder.Build();

            return(container.AsCompletedTask());
        }
Esempio n. 6
0
        public void SetUp()
        {
            var assemblies = new[]
            {
                typeof(AssemblyFetcher).Assembly,
                typeof(AssemblyFetcherTest).Assembly,
                typeof(Rhino.Mocks.MockRepository).Assembly,
            }.ToList();

            this.methodVisibility = MemberVisibility.Public;
            this.assemblyName     = typeof(AssemblyFetcherTest).Assembly.Location;
            this.inputAssemblies  = assemblies.Select(e => e.Location).ToList();
            this.testObject       = new AssemblyFetcher(this.methodVisibility, this.assemblyName, this.inputAssemblies);
        }
        public void FetchingAssemblies_FetchesNugetPackageReferences()
        {
            // Arrange
            var testAssembly         = typeof(AssemblyFetcherUnitTests).Assembly;
            var nugetPackageAssembly = typeof(Maybe <>).Assembly;
            var containerConfig      = new ContainerConfiguration(testAssembly, "Mmu.Mlh");

            // Act
            var actualReferenceAssemblies = AssemblyFetcher.GetApplicationRelevantAssemblies(containerConfig);

            // Assert
            var actualExtensionsAssembly = actualReferenceAssemblies.FirstOrDefault(f => f == nugetPackageAssembly);

            Assert.That(actualExtensionsAssembly, Is.Not.Null);
        }
        // ASP.Net Core DI scenario
        public static void PopulateRegistry(ContainerConfiguration containerConfig, ServiceRegistry registry)
        {
            var assemblies = AssemblyFetcher.GetApplicationRelevantAssemblies(containerConfig);

            registry.Scan(
                scanner =>
            {
                assemblies.ForEach(scanner.Assembly);
                scanner.LookForRegistries();
            });

            if (containerConfig.InitializeAutoMapper)
            {
                AutoMapperInitializer.InitializeAutoMapper(registry, assemblies);
            }
        }
Esempio n. 9
0
 public void LoadAssemblyWithNonValidFilenameInInputAssembliesThrows()
 {
     this.inputAssemblies[1] = "A assembly that can't be a valid one.dll";
     this.testObject         = new AssemblyFetcher(this.methodVisibility, "HelloTest", this.inputAssemblies);
     Assert.Throws <ArgumentException>(() => testObject.LoadAssembly());
 }
Esempio n. 10
0
 public void LoadAssemblyWithNullInInputAssembliesThrows()
 {
     this.inputAssemblies[1] = null;
     this.testObject         = new AssemblyFetcher(this.methodVisibility, "HelloTest", this.inputAssemblies);
     Assert.Throws <ArgumentNullException>(() => testObject.LoadAssembly());
 }
Esempio n. 11
0
 public void TearDown()
 {
     this.testObject = null;
 }