Ejemplo n.º 1
0
        public IContentType AddContentType(string typeName, IEnumerable <string> baseTypeNames)
        {
            if (typeName == null)
            {
                throw new ArgumentNullException();
            }

            string uppercaseTypeName = typeName.ToUpperInvariant();

            if (uppercaseTypeName == _unknownName)
            {
                throw new InvalidOperationException();
            }


            if (!_contentTypes.TryGetValue(typeName, out MockContentType type))
            {
                _contentTypes[typeName] = new MockContentType(typeName, new IContentType[0]);
            }
            List <IContentType> baseTypes = new List <IContentType>();

            foreach (var baseTypeName in baseTypeNames)
            {
                baseTypes.Add(AddContentType(baseTypeName, Empty));
            }
            return(type);
        }
Ejemplo n.º 2
0
        public MockList CreateMockObject()
        {
            var _listMockObject = new MockList()
            {
                Title              = "ListTitle",
                Description        = "Description",
                BaseType           = 1,
                EnableContentTypes = true,
                VersioningEnbabled = false
            };

            List <MockContentType> _contentTypeRefs = new List <MockContentType>();

            MockContentType _cti1 = new MockContentType()
            {
                ID   = "0x0101000728167cd9c94899925ba69c4af6743e01",
                Name = "SAMPLE1 CONTENT TYPE"
            };

            MockContentType _cti2 = new MockContentType()
            {
                ID   = "0x0101000728167cd9c94899925ba69c4af6743e02",
                Name = "SAMPLE1 CONTENT TYPE"
            };

            _contentTypeRefs.Add(_cti1);
            _contentTypeRefs.Add(_cti2);

            _listMockObject.ContentTypes = _contentTypeRefs;

            return(_listMockObject);
        }
Ejemplo n.º 3
0
 public MockContentTypeRegistryService()
 {
     _contentTypes[_unknownName] = _unknownType = new MockContentType(_unknownName, new IContentType[0]);
 }