public void Create_ReturnsTheFirstInstallerThatHasTheSameTypeNameAsNamePassedAsAnArgument()
        {
            var sut = new InstallerFactory(() => GetType().Assembly);
            var result = sut.Create(typeof(TestInstaller2).Name);

            Assert.IsType<TestInstaller2>(result);
        }
        public void Create_ReturnsTheFirstInstallerThatHasTheSameTypeNameAsNamePassedAsAnArgument()
        {
            var sut    = new InstallerFactory(() => GetType().Assembly);
            var result = sut.Create(typeof(TestInstaller2).Name);

            Assert.IsType <TestInstaller2>(result);
        }
        public void Create_ReturnsTheFirstInstallerInTheAssemblyThatIsMarkedAsTheDefaultInstaller()
        {
            var sut = new InstallerFactory(() => GetType().Assembly);
            var result = sut.Create();

            Assert.IsType<TestInstaller1>(result);
        }
        public void Create_ReturnsTheFirstInstallerInTheAssemblyThatIsMarkedAsTheDefaultInstaller()
        {
            var sut    = new InstallerFactory(() => GetType().Assembly);
            var result = sut.Create();

            Assert.IsType <TestInstaller1>(result);
        }
예제 #5
0
        protected BaseCommand()
        {
            var assemblyLoader = new AssemblyLoader(() => this.AssemblyFile);

            InstallerFactory = new InstallerFactory(assemblyLoader.Load);
            Parameters       = new Hashtable();
        }
예제 #6
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var logger  = new CommandLogger(this);
            var context = new InstallerContext(Parameters, logger);

            IInstaller installer = InstallerFactory.Create();

            try
            {
                installer.Install(context);
            }
            catch (Exception exception)
            {
                logger.Error(exception);
            }
        }
 public void Create_ThrowsWhenUnableToFindADefaultInstallerInAnAssembly()
 {
     var sut = new InstallerFactory(() => typeof(MyInstaller).Assembly);
     Assert.Throws<InvalidOperationException>(() => sut.Create());
 }
 public void Create_ThrowsWhenTypeNameArgumentIsNull()
 {
     var sut = new InstallerFactory(() => GetType().Assembly);
     Assert.Throws<ArgumentNullException>(() => sut.Create(null));
 }
 public void Constructor_ConstructsAnInstallerFactory()
 {
     var sut = new InstallerFactory(() => GetType().Assembly);
     Assert.IsAssignableFrom<IInstallerFactory>(sut);
 }
        public void Create_ThrowsWhenTypeNameArgumentIsNull()
        {
            var sut = new InstallerFactory(() => GetType().Assembly);

            Assert.Throws <ArgumentNullException>(() => sut.Create(null));
        }
        public void Create_ThrowsWhenUnableToFindADefaultInstallerInAnAssembly()
        {
            var sut = new InstallerFactory(() => typeof(MyInstaller).Assembly);

            Assert.Throws <InvalidOperationException>(() => sut.Create());
        }
        public void Constructor_ConstructsAnInstallerFactory()
        {
            var sut = new InstallerFactory(() => GetType().Assembly);

            Assert.IsAssignableFrom <IInstallerFactory>(sut);
        }
예제 #13
0
 protected BaseCommand()
 {
     var assemblyLoader = new AssemblyLoader(() => this.AssemblyFile);
     InstallerFactory = new InstallerFactory(assemblyLoader.Load);
     Parameters = new Hashtable();
 }