public void InstallChildContainer() { var container = new WindsorContainer(new XmlInterpreter(Xml.Embedded("installerconfig.xml"))); var child1 = container.GetChildContainer("child1"); Assert.IsNotNull(child1); Assert.AreEqual(child1.Parent, container); Assert.IsTrue(child1.Kernel.HasComponent(typeof(ICalcService))); Assert.IsTrue(child1.Kernel.HasComponent("child_calcservice")); var calcservice = container.Resolve<ICalcService>("calcservice"); var child_calcservice = child1.Resolve<ICalcService>(); Assert.AreNotEqual(calcservice, child_calcservice); }
public void InstallChildContainer() { var container = new WindsorContainer(ConfigHelper.ResolveConfigPath("installerconfig.xml")); var child1 = container.GetChildContainer("child1"); Assert.IsNotNull(child1); Assert.AreEqual(child1.Parent, container); Assert.IsTrue(child1.Kernel.HasComponent(typeof(ICalcService))); Assert.IsTrue(child1.Kernel.HasComponent("child_calcservice")); var calcservice = container.Resolve("calcservice") as ICalcService; var child_calcservice = child1.Resolve(typeof(ICalcService)) as ICalcService; Assert.AreNotEqual(calcservice, child_calcservice); }
public void InstallChildContainer() { var container = new WindsorContainer(new XmlInterpreter(Xml.Embedded("installerconfig.xml"))); var child1 = container.GetChildContainer("child1"); Assert.IsNotNull(child1); Assert.AreEqual(child1.Parent, container); Assert.IsTrue(child1.Kernel.HasComponent(typeof(ICalcService))); Assert.IsTrue(child1.Kernel.HasComponent("child_calcservice")); var calcservice = container.Resolve <ICalcService>("calcservice"); var child_calcservice = child1.Resolve <ICalcService>(); Assert.AreNotEqual(calcservice, child_calcservice); }
private static void Main(string[] args) { try { //Get user inputs var inputDataPath = ReadInput("Please enter input data path", @"Data\InputData.csv"); var outputDataPath = ReadInput("Please enter output data path", @"Data\OutputData.csv"); var taxTablePath = ReadInput("Please enter tax table path", @"Tax\TaxTable.csv"); //Register components in Calculator assembly RegisterContainers(); //Generate payslip var calculatorContainer = Container.GetChildContainer(Calculator.Register.Container.Name); var payslipManager = calculatorContainer.Resolve <IPayslipManager>(); payslipManager.GeneratePayslip(calculatorContainer, inputDataPath, outputDataPath, taxTablePath); WriteLine($"Payslip is written to '{outputDataPath}'."); } catch (Exception e) { WriteLine($"Failed to generate payslip: {e.Message}"); } }