public void Create_ThrowsWhenAssemblyFileDoesNotExist()
        {
            var context = Substitute.For<ICommand>();
            context.AssemblyFile.Returns("");

            var sut = new AssemblyInstallerFactoryFinder(context);

            Assert.Throws<FileNotFoundException>(() => sut.Find());
        }
        public void Create_ThrowsWhenFactoryNotFoundInAssembly()
        {
            var context = Substitute.For<ICommand>();
            var assemblyFile = Path.Combine(TestContext.OutputDirectoryPath, "FluentInstallation.TestEmptyAssembly.dll");
            context.AssemblyFile.Returns(assemblyFile);

            var sut = new AssemblyInstallerFactoryFinder(context);

            Assert.Throws<InstallationException>(() => sut.Find());
        }
        public void Create_LoadsFactoryCorrectlyWhenGivenFullPathToAssembly()
        {
            var context = Substitute.For<ICommand>();
            var assemblyFile = Path.Combine(TestContext.OutputDirectoryPath, "FluentInstallation.TestAssembly.dll");
            context.AssemblyFile.Returns(assemblyFile);

            var sut = new AssemblyInstallerFactoryFinder(context);

            var actual = sut.Find();

            Assert.IsAssignableFrom<IInstallerFactory>(actual);
        }
        public void Create_LoadsFactoryCorrectlyWhenGivenAssemblyFileNameAndAssemblyIsInSameDirectory()
        {
            var context = Substitute.For<ICommand>();
            var assemblyFile = "FluentInstallation.TestAssembly.dll";
            context.AssemblyFile.Returns(assemblyFile);

            var sut = new AssemblyInstallerFactoryFinder(context);

            var actual = sut.Find();

            Assert.IsAssignableFrom<IInstallerFactory>(actual);
        }