public void CanInstallBinsorInlineScript() { _container.Install(BinsorScript.Inline( @"component 'default_repository', IRepository, NHRepository: lifestyle Transient" )); bool has_repos = _container.Kernel.HasComponent(typeof(IRepository <>)); Assert.IsTrue(has_repos, "should have generic repository!"); }
public void CanExtendComponentsRegisteredInCode() { using (IWindsorContainer container = new RhinoContainer()) { container.Register(Component.For <GstCalculator>() .Named("gstcalculator") .DependsOn(Property.ForKey("GstRate").Eq(15m))); IWindsorInstaller installer = BinsorScript.Inline(new StringBuilder().AppendLine("extend \"gstcalculator\":") .AppendLine(" GstRate = decimal(50)").ToString()); installer.Install(container, null); GstCalculator calculator = container.Resolve <GstCalculator>(); Assert.AreEqual(50m, calculator.GstRate); } }