Ejemplo n.º 1
0
        public void StoreAssemblyShouldCopyFile()
        {
            var clock         = new StubClock();
            var appDataFolder = new StubAppDataFolder(clock);

            var assembly = GetType().Assembly;
            var name     = assembly.GetName().Name;

            {
                var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder,
                                                                          new DefaultAssemblyLoader(Enumerable.Empty <IAssemblyNameResolver>()));
                dependenciesFolder.StoreAssembly(name, assembly.Location);
            }

            {
                var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder,
                                                                          new DefaultAssemblyLoader(Enumerable.Empty <IAssemblyNameResolver>()));
                Assert.Equal(dependenciesFolder.AssemblyExists(name), true);
                Assert.Equal(dependenciesFolder.LoadAssembly(name), GetType().Assembly);
                {
                    //shouldn't throw Exception
                    dependenciesFolder.DeleteAssembly(name);
                }

                Assert.Equal(dependenciesFolder.LoadAssembly(name), null);
            }
        }
Ejemplo n.º 2
0
        public void LoadAssemblyShouldNotThrowIfAssemblyNotFound()
        {
            var clock              = new StubClock();
            var appDataFolder      = new StubAppDataFolder(clock);
            var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder, new DefaultAssemblyLoader(Enumerable.Empty <IAssemblyNameResolver>()));

            Assert.That(dependenciesFolder.LoadAssembly("foo"), Is.Null);
        }
Ejemplo n.º 3
0
        public void StoreAssemblyShouldCopyFile()
        {
            var clock         = new StubClock();
            var appDataFolder = new StubAppDataFolder(clock);

            var assembly = GetType().Assembly;
            var name     = assembly.GetName().Name;

            {
                var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder, new DefaultAssemblyLoader(Enumerable.Empty <IAssemblyNameResolver>()));
                dependenciesFolder.StoreAssembly(name, assembly.Location);
            }

            {
                var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder, new DefaultAssemblyLoader(Enumerable.Empty <IAssemblyNameResolver>()));
                Assert.That(dependenciesFolder.AssemblyExists(name), Is.True);
                Assert.That(dependenciesFolder.LoadAssembly(name), Is.SameAs(GetType().Assembly));
                Assert.DoesNotThrow(() => dependenciesFolder.DeleteAssembly(name));
                Assert.That(dependenciesFolder.LoadAssembly(name), Is.Null);
            }
        }