public void Ctor_StoresPathsProvided()
        {
            var instance = new AssemblyDetails("one", "two", typeof(TestInstaller));

            Assert.That(instance.Path, Is.EqualTo("one"));
            Assert.That(instance.BinaryPath, Is.EqualTo("two"));
        }
 public ConfiguredInstallationManifest(InstallationConfiguration installationConfiguration, ISiteInstaller sourceInstaller, string path, AssemblyDetails discoveredDetails)
 {
     InstallationConfiguration = installationConfiguration;
     SourceInstaller = sourceInstaller;
     Path = path;
     DiscoveredDetails = discoveredDetails;
 }
        public void FindFirstAvailableInstaller_AssemblyFound_ReturnsManifest()
        {
            var foundAssembly = new AssemblyDetails("", "", typeof(TestInstaller));
            _discoverer.Setup(x => x.FindAssemblies(It.IsAny<string>())).Returns(new List<AssemblyDetails> { foundAssembly });
            _loader.Setup(x => x.LoadFrom(It.IsAny<string>())).Returns(Assembly.GetAssembly(typeof(PathScannerTests)));

            var manifest = _pathScanner.FindFirstAvailableInstaller();

            Assert.That(manifest, Is.TypeOf<ConfiguredInstallationManifest>());
        }
        public void FindFirstAvailableInstaller_MultipleAssembliesFound_ReturnsManifestForFirstOne()
        {
            var expectedAssembly = new AssemblyDetails("c:\\path", "c:\\path\\expect.this.dll", typeof(TestInstaller));
            var shouldNotCreate = new AssemblyDetails("c:\\path", "c:\\path\\do.not.expect.this.dll", typeof(TestInstaller));
            _discoverer.Setup(x => x.FindAssemblies(It.IsAny<string>())).Returns(new List<AssemblyDetails> { expectedAssembly, shouldNotCreate });
            _loader.Setup(x => x.LoadFrom("c:\\path\\expect.this.dll")).Returns(Assembly.GetAssembly(typeof(PathScannerTests)));

            var manifest = _pathScanner.FindFirstAvailableInstaller();

            Assert.That(manifest.DiscoveredDetails, Is.EqualTo(expectedAssembly));
        }
        public void FindFirstAvailableInstaller_AssemblyFound_ReturnsConfiguredManifestForAssembly()
        {
            var foundAssembly = new AssemblyDetails("c:\\path", "c:\\path\\binary.dll", typeof(TestInstaller));
            _discoverer.Setup(x => x.FindAssemblies(It.IsAny<string>())).Returns(new List<AssemblyDetails> { foundAssembly });
            _loader.Setup(x => x.LoadFrom("c:\\path\\binary.dll")).Returns(Assembly.GetAssembly(typeof(PathScannerTests)));

            var manifest = _pathScanner.FindFirstAvailableInstaller();

            Assert.That(manifest.InstallationConfiguration, Is.Not.Null);
            Assert.That(manifest.Path, Is.EqualTo(_siteScanPath));
            Assert.That(manifest.SourceInstaller, Is.InstanceOf<ISiteInstaller>());
        }
        public void Ctor_StoresProvidedArguments()
        {
            var config = new InstallationConfiguration("path", null);
            var installer = new TestInstaller();
            const string path = "path";
            var discoveredDetails = new AssemblyDetails(path, "binary.dll", typeof (TestInstaller));

            var dto = new ConfiguredInstallationManifest(config, installer, path, discoveredDetails);

            Assert.That(dto.InstallationConfiguration, Is.EqualTo(config));
            Assert.That(dto.SourceInstaller, Is.EqualTo(installer));
            Assert.That(dto.Path, Is.EqualTo(path));
            Assert.That(dto.DiscoveredDetails, Is.EqualTo(discoveredDetails));
        }