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); } }
public void DeleteAssemblyShouldNotThrowIfAssemblyNotFound() { var clock = new StubClock(); var appDataFolder = new StubAppDataFolder(clock); var dependenciesFolder = new DefaultAssemblyProbingFolder(appDataFolder, new DefaultAssemblyLoader(Enumerable.Empty <IAssemblyNameResolver>())); Assert.DoesNotThrow(() => dependenciesFolder.DeleteAssembly("foo")); }
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); } }