public void LoadAndCheckAssembly_WithInValidPath_ReturnsBinderType()
 {
     var context = new DefaultBinderTypeRegistry.SearchingAssemblyLoadContext();
     var path = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Steeltoe.Stream.FooBar.dll";
     var result = DefaultBinderTypeRegistry.LoadAndCheckAssembly(context, path);
     Assert.Null(result);
     context.Unload();
 }
예제 #2
0
        public void LoadAndCheckAssembly_WithInValidPath_DoesNotReturnsBinderType()
        {
            var paths          = BuildPaths(null);
            var context        = new MetadataLoadContext(new PathAssemblyResolver(paths));
            var binderAssembly = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Steeltoe.Stream.FooBar.dll";
            var result         = DefaultBinderTypeRegistry.LoadAndCheckAssembly(context, binderAssembly);

            Assert.Null(result);
            context.Dispose();
        }
 public void LoadAndCheckAssembly_WithValidPath_ReturnsBinderType()
 {
     var context = new DefaultBinderTypeRegistry.SearchingAssemblyLoadContext();
     var path = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Steeltoe.Stream.TestBinder.dll";
     var result = DefaultBinderTypeRegistry.LoadAndCheckAssembly(context, path);
     Assert.Equal(path, result.AssemblyPath);
     Assert.Equal("Steeltoe.Stream.TestBinder.Startup, Steeltoe.Stream.TestBinder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", result.ConfigureClass);
     Assert.Equal("testbinder", result.Name);
     context.Unload();
 }
예제 #4
0
        public void LoadAndCheckAssembly_WithDefaultPath_ReturnsBinderType()
        {
            var binderDir = GetSearchDirectories("TestBinder")[0];
            var paths     = BuildPaths(binderDir);

            var context        = new MetadataLoadContext(new PathAssemblyResolver(paths));
            var binderAssembly = binderDir + Path.DirectorySeparatorChar + "Steeltoe.Stream.TestBinder.dll";
            var result         = DefaultBinderTypeRegistry.LoadAndCheckAssembly(context, binderAssembly);

            Assert.Equal(binderAssembly, result.AssemblyPath);
            Assert.Matches(@"Steeltoe.Stream.TestBinder.Startup, Steeltoe.Stream.TestBinder, Version=[\d.]+, Culture=neutral, PublicKeyToken=null", result.ConfigureClass);
            Assert.Equal("testbinder", result.Name);
            context.Dispose();
        }