Ejemplo n.º 1
0
        public void TryResolveAssemblyDependency_ResolveKnownAssembly_Success()
        {
            // arrange

            DependenciesConfigXml dcMock = this.CreateMockDependenciesConfig();
            DependencyResolver dr = new DependencyResolver( dcMock );
            Assembly expectedAssembly = Assembly.GetExecutingAssembly();
            string path = Path.GetDirectoryName( expectedAssembly.Location );
            string assemblyName = expectedAssembly.FullName;
            dr.AddProbingPath( path, false );
            Assembly resolvedAssembly = null;

            // act
            resolvedAssembly = dr.TryResolveAssemblyDependency( assemblyName );

            // assert
            Assert.IsNotNull( resolvedAssembly );
            Assert.AreEqual( expectedAssembly, resolvedAssembly );
        }
Ejemplo n.º 2
0
        public void TryResolveAssemblyDependency_TypeNameNull_RaiseArgumentNulLException()
        {
            // arrange

            DependenciesConfigXml dcMock = this.CreateMockDependenciesConfig();
            DependencyResolver dr = new DependencyResolver( dcMock );
            Assembly expectedAssembly = Assembly.GetExecutingAssembly();
            string path = Path.GetDirectoryName( expectedAssembly.Location );
            string assemblyName = null;
            dr.AddProbingPath( path, false );
            Assembly resolvedAssembly = null;

            // act
            resolvedAssembly = dr.TryResolveAssemblyDependency( assemblyName );

            // assert
        }
Ejemplo n.º 3
0
        public void TryResolveAssemblyDependency_ResolveKnownAssembly_RaiseBadImageFormatException()
        {
            // arrange

            DependenciesConfigXml dcMock = this.CreateMockDependenciesConfig();
            DependencyResolver dr = new DependencyResolver( dcMock );
            Assembly expectedAssembly = Assembly.GetExecutingAssembly();
            string path = Path.GetDirectoryName( expectedAssembly.Location );
            string assemblyName = "InvalidDLL";
            dr.AddProbingPath( path, false );
            Assembly resolvedAssembly = null;

            // act
            resolvedAssembly = dr.TryResolveAssemblyDependency( assemblyName );

            // assert
        }