public IValueCollectionProvider ValueCollection() { var vc = new ValueCollectionProvider(); var entVc = new EntityValueProvider(AppSettings(), "AppSettings"); vc.Sources.Add("AppSettings".ToLower(), entVc); vc.Sources.Add("AppResources".ToLower(), new EntityValueProvider(AppResources(), "AppResources")); return vc; }
public void ValueProvider_EntityValueProvider() { IValueProvider valProv = new EntityValueProvider(new Entity_Test().TestEntityDaniel()); bool found = false; Assert.IsTrue(valProv.Has("FirstName"), "Has first name"); Assert.IsTrue(valProv.Has("EntityId"), "Has entity id"); Assert.IsTrue(valProv.Has("EntityTitle"), "Has entity title"); Assert.AreEqual("Mettler", valProv.Get("LastName", "", ref found)); Assert.AreEqual("Mettler", valProv.Get("LastName")); Assert.AreEqual(1.ToString(), valProv.Get("EntityId")); Assert.AreEqual("Daniel", valProv.Get("EntityTitle")); Assert.IsTrue(Convert.ToBoolean(valProv.Get("IsPublished"))); Assert.AreEqual(Guid.Empty, Guid.Parse(valProv.Get("EntityGuid"))); Assert.AreEqual("TestType", valProv.Get("EntityType")); }