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_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);
        }
예제 #5
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 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());
        }