88using System . Diagnostics . Contracts ;
99using System . Threading . Tasks ;
1010using Ignia . Topics . Collections ;
11+ using Ignia . Topics . Querying ;
1112using Ignia . Topics . Repositories ;
1213
1314namespace Ignia . Topics . Tests . TestDoubles {
@@ -41,14 +42,6 @@ public FakeTopicRepository() : base() {
4142 CreateFakeData ( ) ;
4243 }
4344
44- /*==========================================================================================================================
45- | GET CONTENT TYPE DESCRIPTORS
46- \-------------------------------------------------------------------------------------------------------------------------*/
47- /// <summary>
48- /// Retrieves a collection of Content Type Descriptor objects from the configuration section of the data provider.
49- /// </summary>
50- public override ContentTypeDescriptorCollection GetContentTypeDescriptors ( ) => throw new NotImplementedException ( ) ;
51-
5245 /*==========================================================================================================================
5346 | METHOD: LOAD
5447 \-------------------------------------------------------------------------------------------------------------------------*/
@@ -58,7 +51,9 @@ public FakeTopicRepository() : base() {
5851 /// <param name="topicId">The topic identifier.</param>
5952 /// <param name="isRecursive">Determines whether or not to recurse through and load a topic's children.</param>
6053 /// <returns>A topic object.</returns>
61- public override Topic Load ( int topicId , bool isRecursive = true ) => throw new NotImplementedException ( ) ;
54+ public override Topic Load ( int topicId , bool isRecursive = true ) {
55+ return ( topicId < 0 ) ? _cache : _cache . FindFirst ( t => t . Id . Equals ( topicId ) ) ;
56+ }
6257
6358 /// <summary>
6459 /// Loads a topic (and, optionally, all of its descendants) based on the specified key name.
@@ -72,7 +67,8 @@ public override Topic Load(string topicKey = null, bool isRecursive = true) {
7267 | Lookup by TopicKey
7368 \-----------------------------------------------------------------------------------------------------------------------*/
7469 if ( ! String . IsNullOrWhiteSpace ( topicKey ) ) {
75- throw new NotImplementedException ( ) ;
70+ topicKey = topicKey . Contains ( ":" ) ? topicKey : "Root:" + topicKey ;
71+ return _cache . FindFirst ( t => t . GetUniqueKey ( ) . Equals ( topicKey ) ) ;
7672 }
7773
7874 /*------------------------------------------------------------------------------------------------------------------------
@@ -233,9 +229,12 @@ private void CreateFakeData() {
233229 var configuration = TopicFactory . Create ( "Configuration" , "Container" , rootTopic ) ;
234230 var contentTypes = TopicFactory . Create ( "ContentTypes" , "ContentTypeDescriptor" , configuration ) ;
235231
236- TopicFactory . Create ( "ContentType " , "ContentTypeDescriptor" , contentTypes ) ;
232+ TopicFactory . Create ( "ContentTypeDescriptor " , "ContentTypeDescriptor" , contentTypes ) ;
237233 TopicFactory . Create ( "Page" , "ContentTypeDescriptor" , contentTypes ) ;
238234 TopicFactory . Create ( "Container" , "ContentTypeDescriptor" , contentTypes ) ;
235+ TopicFactory . Create ( "Lookup" , "ContentTypeDescriptor" , contentTypes ) ;
236+ TopicFactory . Create ( "LookupListItem" , "ContentTypeDescriptor" , contentTypes ) ;
237+ TopicFactory . Create ( "List" , "ContentTypeDescriptor" , contentTypes ) ;
239238
240239 /*------------------------------------------------------------------------------------------------------------------------
241240 | Establish metadata
0 commit comments