Пример #1
0
        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);
        }