1+ /*==============================================================================================================================
2+ | Author Ignia, LLC
3+ | Client Ignia, LLC
4+ | Project Topics Library
5+ \=============================================================================================================================*/
6+ using OnTopic . Attributes ;
7+ using OnTopic . Internal . Reflection ;
8+ using OnTopic . Tests . Entities ;
9+
10+ namespace OnTopic . Tests . ViewModels {
11+
12+ /*============================================================================================================================
13+ | VIEW MODEL: CUSTOM TOPIC
14+ \---------------------------------------------------------------------------------------------------------------------------*/
15+ /// <summary>
16+ /// Provides a topic view model which maps to the <see cref="CustomTopic"/>.
17+ /// </summary>
18+ /// <remarks>
19+ /// <para>
20+ /// This is a sample class intended for test purposes only; it is not designed for use in a production environment.
21+ /// </para>
22+ /// <para>
23+ /// Typically, topics wouldn't end in "Topic" (outside of <see cref="Topic"/>). Because <see cref="CustomTopic"/> does,
24+ /// the corresponding topic view model must be named <see cref="CustomTopicTopicViewModel"/> (with two <c>Topic</c>).
25+ /// Otherwise, when the <see cref="TypeAccessor"/> attempts to match it to its implied content type, it will strip the
26+ /// <c>TopicViewModel</c>, per conventions, and discover that there isn't a match for <c>Custom</c>. This is a peculiarity
27+ /// of the test case, and not something we'd expect in real-life scenarios.
28+ /// </para>
29+ /// </remarks>
30+ public class CustomTopicTopicViewModel {
31+
32+ /*==========================================================================================================================
33+ | CONSTRUCTOR
34+ \-------------------------------------------------------------------------------------------------------------------------*/
35+ public CustomTopicTopicViewModel (
36+ string title ,
37+ string webPath ,
38+ string ? textAttribute ,
39+ bool booleanAttribute ,
40+ string booleanAsStringAttribute ,
41+ int numericAttribute ,
42+ string nonNullableAttribute ,
43+ DateTime dateTimeAttribute ,
44+ Topic ? topicReference ,
45+ string ? unmatchedMember ,
46+ DateTime ? isHidden
47+ ) {
48+ Title = title ;
49+ WebPath = webPath ;
50+ TextAttribute = textAttribute ;
51+ BooleanAttribute = booleanAttribute ;
52+ BooleanAsStringAttribute = booleanAsStringAttribute ;
53+ NumericAttribute = numericAttribute ;
54+ NonNullableAttribute = nonNullableAttribute ;
55+ DateTimeAttribute = dateTimeAttribute ;
56+ TopicReference = topicReference ;
57+ UnmatchedMember = unmatchedMember ;
58+ IsHidden = isHidden ;
59+ }
60+
61+ /*==========================================================================================================================
62+ | TITLE
63+ \-------------------------------------------------------------------------------------------------------------------------*/
64+ /// <summary>
65+ /// Provides a reference to the <see cref="Topic.Title"/> property.
66+ /// </summary>
67+ public string Title { get ; init ; }
68+
69+ /*==========================================================================================================================
70+ | WEB PATH
71+ \-------------------------------------------------------------------------------------------------------------------------*/
72+ /// <summary>
73+ /// Provides the root-relative web path of the Topic, based on an assumption that the root topic is bound to the root of
74+ /// the site.
75+ /// </summary>
76+ public string WebPath { get ; init ; }
77+
78+ /*==========================================================================================================================
79+ | TEXT ATTRIBUTE
80+ \-------------------------------------------------------------------------------------------------------------------------*/
81+ /// <summary>
82+ /// Provides a text property which is intended to be mapped to a text attribute.
83+ /// </summary>
84+ public string ? TextAttribute { get ; init ; }
85+
86+ /*==========================================================================================================================
87+ | BOOLEAN ATTRIBUTE
88+ \-------------------------------------------------------------------------------------------------------------------------*/
89+ /// <summary>
90+ /// Provides a Boolean property which is intended to be mapped to a Boolean attribute.
91+ /// </summary>
92+ public bool BooleanAttribute { get ; init ; }
93+
94+ /*==========================================================================================================================
95+ | BOOLEAN AS STRING ATTRIBUTE
96+ \-------------------------------------------------------------------------------------------------------------------------*/
97+ /// <summary>
98+ /// Provides a string property which is intended to be mapped to a Boolean attribute.
99+ /// </summary>
100+ public string BooleanAsStringAttribute { get ; init ; }
101+
102+ /*==========================================================================================================================
103+ | NUMERIC ATTRIBUTE
104+ \-------------------------------------------------------------------------------------------------------------------------*/
105+ /// <summary>
106+ /// Provides a numeric property which is intended to be mapped to a numeric attribute.
107+ /// </summary>
108+ public int NumericAttribute { get ; init ; }
109+
110+ /*==========================================================================================================================
111+ | NON-NULLABLE ATTRIBUTE
112+ \-------------------------------------------------------------------------------------------------------------------------*/
113+ /// <summary>
114+ /// Provides a property which does not permit null values as a means of ensuring the business logic is enforced when
115+ /// removing values.
116+ /// </summary>
117+ public string NonNullableAttribute { get ; init ; }
118+
119+ /*==========================================================================================================================
120+ | DATE/TIME ATTRIBUTE
121+ \-------------------------------------------------------------------------------------------------------------------------*/
122+ /// <summary>
123+ /// Provides a date/time property which is intended to be mapped to a date/time attribute.
124+ /// </summary>
125+ public DateTime DateTimeAttribute { get ; init ; }
126+
127+ /*==========================================================================================================================
128+ | TOPIC REFERENCE
129+ \-------------------------------------------------------------------------------------------------------------------------*/
130+ /// <summary>
131+ /// Provides a topic reference property which is intended to be mapped to a topic reference.
132+ /// </summary>
133+ public Topic ? TopicReference { get ; init ; }
134+
135+ /*==========================================================================================================================
136+ | UNMATCHED MEMBER
137+ \-------------------------------------------------------------------------------------------------------------------------*/
138+ /// <summary>
139+ /// Provides a member that doesn't match any members of either <see cref="CustomTopic"/> or <see cref="Topic"/>.
140+ /// </summary>
141+ public string ? UnmatchedMember { get ; init ; }
142+
143+ /*==========================================================================================================================
144+ | MISMATCHED MEMBER
145+ \-------------------------------------------------------------------------------------------------------------------------*/
146+ /// <summary>
147+ /// Provides a member that corresponds to a property on <see cref="Topic"/>, but with an incompatible type.
148+ /// </summary>
149+ public DateTime ? IsHidden { get ; init ; }
150+
151+
152+ } //Class
153+ } //Namespace
0 commit comments