public void GetValue_IllegalNodePath() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetValue(""); Assert.IsNull(actual); }
/// <summary> /// コンポーネント作成処理の生成 /// </summary> /// <returns></returns> private IComponentCreator CreateComponentCreator() { // 設定ファイルから接続文字列を読み取り var config = QuillAppConfig.Load(); var generator = new ProxyGenerator(); var connectionString = config.GetValue("db.connection_string"); // コネクション生成処理を設定 // (デフォルトの動きは引数なしでnew) var creator = new ComponentCreators(); creator.AddCreator(typeof(IDataSource), t => { return(new DataSourceImpl(() => new SqlConnection(connectionString))); }); var componentTypeElements = config.GetElement("components").Elements().ToList(); componentTypeElements.ForEach(element => { var typeName = element.Value; var ifTypeName = element.Attribute("interface").Value; creator.AddCreator(TypeUtils.GetType(ifTypeName), t => Activator.CreateInstance(TypeUtils.GetType(typeName))); }); return(creator); }
public void GetValue_AdditionalFilter() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetValue("Par.Bro", e => e.Value.StartsWith("a")); Assert.True(actual.StartsWith("a")); }
public void GetValue_Child() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetValue("Par.Chi"); Assert.AreEqual("ChildValue", actual); }
public void GetValue() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetValue("hoge"); Assert.AreEqual("XXX", actual); }
public void GetElements() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetElements("At"); Assert.IsTrue(actual.Count() > 0); }
public void GetElement_AdditionalFilter() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetElement("At", el => el.GetAttrValue("hogeAttr") == "wao"); Assert.NotNull(actual); Assert.AreEqual("wao", actual.GetAttrValue("hogeAttr")); }
public void GetElement() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetElement("At"); Assert.NotNull(actual); Assert.AreEqual(typeof(XElement), actual.GetType()); }
public void GetValues_IllegalNodePath() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetValues(""); Assert.NotNull(actual); Assert.AreEqual(0, actual.Count()); }
public void GetValues_AdditionalFilter() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetValues("Par.Sis", e => e.Value.StartsWith("x")); Assert.AreEqual(3, actual.Count()); actual.ForEach(v => Assert.IsTrue(v.StartsWith("x"))); }
public void GetValues() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetValues("Mul"); Assert.AreEqual(2, actual.Count()); actual.ForEach(v => Assert.IsNotNull(v)); }
public void GetElements_AdditionalFilter() { IQuillConfig target = QuillAppConfig.Load(); var actual = target.GetElements("At", el => el.GetAttrValue("hogeAttr") == "wao"); Assert.IsTrue(actual.Count() > 0); actual.ForEach(el => Assert.AreEqual("wao", el.GetAttrValue("hogeAttr"))); }
public void Load_Exists() { IQuillConfig target = QuillAppConfig.Load(); Assert.NotNull(target); }