public void CanSpecifyNamespace() { DynamicTypeManager mgr = new DynamicTypeManager(new DynamicTypeDataRepository(), DataSettings.Default); mgr.DynamicTypeDataRepository.Query <DynamicTypeDescriptor>(d => d.Id > 0).Each(d => mgr.DynamicTypeDataRepository.Delete(d)); mgr.DynamicTypeDataRepository.Query <DynamicTypePropertyDescriptor>(p => p.Id > 0).Each(p => mgr.DynamicTypeDataRepository.Delete(p)); string testType = nameof(CanSpecifyNamespace); string testType2 = nameof(CanSpecifyNamespace) + "2"; string testNamespace = "My.Test.Namespace"; mgr.AddType(testType, testNamespace); mgr.AddType(testType2, testNamespace); DynamicNamespaceDescriptor ns = mgr.GetNamespaceDescriptor(testNamespace); Expect.IsNotNull(ns, "namspace was null"); Expect.IsTrue(ns.Types.Count == 2); }
public void CanAddType() { DynamicTypeManager mgr = new DynamicTypeManager(new DynamicTypeDataRepository(), DataSettings.Default); string testType = "CanAddTypeTest"; DynamicTypeDescriptor typeDescriptor = mgr.GetTypeDescriptor(testType); Expect.IsNull(typeDescriptor, "typeDescriptor should have been null"); typeDescriptor = mgr.AddType(testType); Expect.IsNotNull(typeDescriptor, "typeDescriptor should NOT have been null"); typeDescriptor = mgr.GetTypeDescriptor(testType); Expect.IsNotNull(typeDescriptor, "typeDescriptor should NOT have been null"); OutLineFormat("{0}", typeDescriptor.PropertiesToString()); }
public void CanGetAssembly() { DynamicTypeManager mgr = new DynamicTypeManager(new DynamicTypeDataRepository(), DataSettings.Default); mgr.DynamicTypeDataRepository.Query <DynamicTypeDescriptor>(d => d.Id > 0).Each(d => mgr.DynamicTypeDataRepository.Delete(d)); mgr.DynamicTypeDataRepository.Query <DynamicTypePropertyDescriptor>(p => p.Id > 0).Each(p => mgr.DynamicTypeDataRepository.Delete(p)); string testType = nameof(CanAddPropertyToType); mgr.AddType(testType); string testProperty = "SomeProperty"; string testProperty2 = "BooleanProperty"; DynamicTypePropertyDescriptor prop = mgr.AddProperty(testType, testProperty, "String"); DynamicTypePropertyDescriptor prop2 = mgr.AddProperty(testType, testProperty2, "Boolean"); Assembly ass = mgr.GetAssembly(); Expect.IsNotNull(ass); }