public void MakeUsingCtor_2() { var made = FactoryUtils.MakeUsingCtor <CTORClass>("node{arg0='7/1/1982'}".AsLaconicConfig()); Aver.AreEqual(1982, made.A); Aver.AreEqual(7, made.B); }
public virtual void Configure(IConfigSectionNode config) { if (Disposed) { return; } if (config == null) { return; } ConfigAttribute.Apply(this, config); var loc = config[TimeLocation.CONFIG_TIMELOCATION_SECTION]; if (loc.Exists) { m_TimeLocation = FactoryUtils.MakeAndConfigure <TimeLocation>(loc, typeof(TimeLocation)); } var ehnode = config[CONFIG_HANDLER_SECTION]; if (ehnode.Exists) { EventHandler = FactoryUtils.MakeUsingCtor <IEventHandler>(ehnode); } }
public void MakeUsingCtor_1() { var made = FactoryUtils.MakeUsingCtor <CTORClass>("node{arg0=1 arg1=2}".AsLaconicConfig()); Aver.AreEqual(1, made.A); Aver.AreEqual(2, made.B); }
public void MakeUsingCtor_3() { var made = FactoryUtils.MakeUsingCtor <CTORClass>("node{type='Azos.Tests.Nub.Configuration.CTORClassDerived, Azos.Tests.Nub' arg0=1 arg1=2}".AsLaconicConfig()); Aver.IsTrue(made is CTORClassDerived); Aver.AreEqual(1, made.A); Aver.AreEqual(2, made.B); }
public void MakeUsingCtor_3() { var made = FactoryUtils.MakeUsingCtor <CTORClass>("node{type='NFX.NUnit.Config.CTORClassDerived, NFX.NUnit' arg0=1 arg1=2}".AsLaconicConfig()); Assert.IsTrue(made is CTORClassDerived); Assert.AreEqual(1, made.A); Assert.AreEqual(2, made.B); }
public void MakeUsingCtor_7_typePattern() { var made = FactoryUtils.MakeUsingCtor <CTORClass>( "node{type='CTORClassDerived' arg0='12' arg1='234'}".AsLaconicConfig(), typePattern: "Azos.Tests.Nub.Configuration.*, Azos.Tests.Nub"); Aver.IsTrue(made is CTORClassDerived); Aver.AreEqual(12, made.A); Aver.AreEqual(234, made.B); }
public void MakeUsingCtor_4() { var made = FactoryUtils.MakeUsingCtor <CTORClass>("node{type='Azos.Tests.Nub.Configuration.CTORClassDerived, Azos.Tests.Nub' arg0='7/1/1982'}".AsLaconicConfig()); Aver.IsTrue(made is CTORClassDerived); Aver.AreEqual(1982, made.A); Aver.AreEqual(7, made.B); Aver.AreEqual(155, ((CTORClassDerived)made).C); }
public void MakeUsingCtor_7_typePattern() { var made = FactoryUtils.MakeUsingCtor <CTORClass>( "node{type='CTORClassDerived' arg0='12' arg1='234'}".AsLaconicConfig(), typePattern: "NFX.NUnit.Config.*, NFX.NUnit"); Assert.IsTrue(made is CTORClassDerived); Assert.AreEqual(12, made.A); Assert.AreEqual(234, made.B); }
public void MakeUsingCtor_4() { var made = FactoryUtils.MakeUsingCtor <CTORClass>("node{type='NFX.NUnit.Config.CTORClassDerived, NFX.NUnit' arg0='7/1/1982'}".AsLaconicConfig()); Assert.IsTrue(made is CTORClassDerived); Assert.AreEqual(1982, made.A); Assert.AreEqual(7, made.B); Assert.AreEqual(155, ((CTORClassDerived)made).C); }
/// <summary> /// Makes multiple permissions from conf node /// </summary> public static IEnumerable <Permission> MultipleFromConf(IConfigSectionNode node) { if (node == null || !node.Exists) { return(Enumerable.Empty <Permission>()); } var result = new List <Permission>(); foreach (var pnode in node.Children.Where(cn => cn.IsSameName(CONFIG_PERMISSION_SECTION))) { result.Add(FactoryUtils.MakeUsingCtor <Permission>(pnode)); } return(result); }
/// <summary> /// Makes multiple permissions from conf node /// </summary> public static IEnumerable <Permission> MultipleFromConf(IConfigSectionNode node, string shortNodeName = null, string typePattern = null ) { if (node == null || !node.Exists) { return(Enumerable.Empty <Permission>()); } var result = new List <Permission>(); foreach (var pnode in node.Children.Where(cn => cn.IsSameName(CONFIG_PERMISSION_SECTION) || (shortNodeName.IsNotNullOrWhiteSpace() && cn.IsSameName(shortNodeName)))) { result.Add(FactoryUtils.MakeUsingCtor <Permission>(pnode, typePattern)); } return(result); }
public void MakeUsingCtor_5() { var made = FactoryUtils.MakeUsingCtor <CTORClass>("node{arg0=1}".AsLaconicConfig()); }