Skip to content

Commit c0152cc

Browse files
committed
Revert: Renamed AttributeDictionary to AttributeValueDictionary
Renamed `AttributeValueDictionary` back to `AttributeDictionary`, thus reverting 38c54c3. It seems this decision was premature, and we can mitigate the naming conflicts without renaming the class, since the out-of-the-box `ViewFeatures` namespace is almost exclusively used in views, and the `AttributeDictionary` is almost exclusively used in view models. This effectively undoes #107.
1 parent e73f71c commit c0152cc

20 files changed

+83
-83
lines changed

OnTopic.Tests/AttributeValueDictionaryTest.cs renamed to OnTopic.Tests/AttributeDictionaryTest.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
namespace OnTopic.Tests {
99

1010
/*============================================================================================================================
11-
| CLASS: ATTRIBUTE VALUE DICTIONARY TEST
11+
| CLASS: ATTRIBUTE DICTIONARY TEST
1212
\---------------------------------------------------------------------------------------------------------------------------*/
1313
/// <summary>
14-
/// Provides unit tests for the <see cref="AttributeValueDictionary"/> class.
14+
/// Provides unit tests for the <see cref="AttributeDictionary"/> class.
1515
/// </summary>
1616
[ExcludeFromCodeCoverage]
1717
public class AttributeDictionaryTest {
@@ -20,8 +20,8 @@ public class AttributeDictionaryTest {
2020
| TEST: GET VALUE: RETURNS EXPECTED VALUE
2121
\-------------------------------------------------------------------------------------------------------------------------*/
2222
/// <summary>
23-
/// Constructs a <see cref="AttributeValueDictionary"/> based on the <paramref name="input"/> data and confirms that <see
24-
/// cref="AttributeValueDictionary.GetValue(String)"/> returns the <paramref name="expected"/> value.
23+
/// Constructs a <see cref="AttributeDictionary"/> based on the <paramref name="input"/> data and confirms that <see cref=
24+
/// "AttributeDictionary.GetValue(String)"/> returns the <paramref name="expected"/> value.
2525
/// </summary>
2626
/// <param name="input">The value to add to the dictionary.</param>
2727
/// <param name="expected">The value expected to be returned.</param>
@@ -34,7 +34,7 @@ public class AttributeDictionaryTest {
3434
[InlineData("Hello", "Hello")]
3535
public void GetValue_ReturnsExpectedValue(string? input, string? expected) {
3636

37-
var attributes = new AttributeValueDictionary() {{"Key", input}};
37+
var attributes = new AttributeDictionary() {{"Key", input}};
3838

3939
Assert.Equal(expected, attributes.GetValue("Key"));
4040

@@ -44,8 +44,8 @@ public void GetValue_ReturnsExpectedValue(string? input, string? expected) {
4444
| TEST: GET BOOLEAN: RETURNS EXPECTED VALUE
4545
\-------------------------------------------------------------------------------------------------------------------------*/
4646
/// <summary>
47-
/// Constructs a <see cref="AttributeValueDictionary"/> based on the <paramref name="input"/> data and confirms that <see
48-
/// cref="AttributeValueDictionary.GetBoolean(String)"/> returns the <paramref name="expected"/> value.
47+
/// Constructs a <see cref="AttributeDictionary"/> based on the <paramref name="input"/> data and confirms that <see cref=
48+
/// "AttributeDictionary.GetBoolean(String)"/> returns the <paramref name="expected"/> value.
4949
/// </summary>
5050
/// <param name="input">The value to add to the dictionary.</param>
5151
/// <param name="expected">The value expected to be returned.</param>
@@ -58,7 +58,7 @@ public void GetValue_ReturnsExpectedValue(string? input, string? expected) {
5858
[InlineData("Hello", null)]
5959
public void GetBoolean_ReturnsExpectedValue(string input, bool? expected) {
6060

61-
var attributes = new AttributeValueDictionary() {{"Key", input}};
61+
var attributes = new AttributeDictionary() {{"Key", input}};
6262

6363
Assert.Equal(expected, attributes.GetBoolean("Key"));
6464

@@ -68,8 +68,8 @@ public void GetBoolean_ReturnsExpectedValue(string input, bool? expected) {
6868
| TEST: GET INTEGER: RETURNS EXPECTED VALUE
6969
\-------------------------------------------------------------------------------------------------------------------------*/
7070
/// <summary>
71-
/// Constructs a <see cref="AttributeValueDictionary"/> based on the <paramref name="input"/> data and confirms that <see
72-
/// cref="AttributeValueDictionary.GetInteger(String)"/> returns the <paramref name="expected"/> value.
71+
/// Constructs a <see cref="AttributeDictionary"/> based on the <paramref name="input"/> data and confirms that <see
72+
/// cref="AttributeDictionary.GetInteger(String)"/> returns the <paramref name="expected"/> value.
7373
/// </summary>
7474
/// <param name="input">The value to add to the dictionary.</param>
7575
/// <param name="expected">The value expected to be returned.</param>
@@ -81,7 +81,7 @@ public void GetBoolean_ReturnsExpectedValue(string input, bool? expected) {
8181
[InlineData("Hello", null)]
8282
public void GetInteger_ReturnsExpectedValue(string input, int? expected) {
8383

84-
var attributes = new AttributeValueDictionary() {{"Key", input}};
84+
var attributes = new AttributeDictionary() {{"Key", input}};
8585

8686
Assert.Equal(expected, attributes.GetInteger("Key"));
8787

@@ -91,8 +91,8 @@ public void GetInteger_ReturnsExpectedValue(string input, int? expected) {
9191
| TEST: GET DOUBLE: RETURNS EXPECTED VALUE
9292
\-------------------------------------------------------------------------------------------------------------------------*/
9393
/// <summary>
94-
/// Constructs a <see cref="AttributeValueDictionary"/> based on the <paramref name="input"/> data and confirms that <see
95-
/// cref="AttributeValueDictionary.GetDouble(String)"/> returns the <paramref name="expected"/> value.
94+
/// Constructs a <see cref="AttributeDictionary"/> based on the <paramref name="input"/> data and confirms that <see cref=
95+
/// "AttributeDictionary.GetDouble(String)"/> returns the <paramref name="expected"/> value.
9696
/// </summary>
9797
/// <param name="input">The value to add to the dictionary.</param>
9898
/// <param name="expected">The value expected to be returned.</param>
@@ -105,7 +105,7 @@ public void GetInteger_ReturnsExpectedValue(string input, int? expected) {
105105
[InlineData("Hello", null)]
106106
public void GetDouble_ReturnsExpectedValue(string input, double? expected) {
107107

108-
var attributes = new AttributeValueDictionary() {{"Key", input}};
108+
var attributes = new AttributeDictionary() {{"Key", input}};
109109

110110
Assert.Equal(expected, attributes.GetDouble("Key"));
111111

@@ -115,8 +115,8 @@ public void GetDouble_ReturnsExpectedValue(string input, double? expected) {
115115
| TEST: GET DATE/TIME: RETURNS EXPECTED VALUE
116116
\-------------------------------------------------------------------------------------------------------------------------*/
117117
/// <summary>
118-
/// Constructs a <see cref="AttributeValueDictionary"/> based on the <paramref name="input"/> data and confirms that <see
119-
/// cref="AttributeValueDictionary.GetDateTime(String)"/> returns the expected value.
118+
/// Constructs a <see cref="AttributeDictionary"/> based on the <paramref name="input"/> data and confirms that <see cref=
119+
/// "AttributeDictionary.GetDateTime(String)"/> returns the expected value.
120120
/// </summary>
121121
/// <param name="input">The value to add to the dictionary.</param>
122122
/// <param name="isSet">Determines whether a valid <see cref="DateTime"/> is expected in response.</param>
@@ -129,7 +129,7 @@ public void GetDouble_ReturnsExpectedValue(string input, double? expected) {
129129
[InlineData("Hello", false)]
130130
public void GetDate_ReturnsExpectedValue(string input, bool isSet) {
131131

132-
var attributes = new AttributeValueDictionary() {{"Key", input}};
132+
var attributes = new AttributeDictionary() {{"Key", input}};
133133

134134
Assert.Equal(isSet? new DateTime(1976, 10, 15, 1, 2, 3) : null, attributes.GetDateTime("Key"));
135135

@@ -139,16 +139,16 @@ public void GetDate_ReturnsExpectedValue(string input, bool isSet) {
139139
| TEST: GET URI: RETURNS EXPECTED VALUE
140140
\-------------------------------------------------------------------------------------------------------------------------*/
141141
/// <summary>
142-
/// Constructs a <see cref="AttributeValueDictionary"/> based on the <paramref name="input"/> data and confirms that <see
143-
/// cref="AttributeValueDictionary.GetUri(String)"/> returns the expected value.
142+
/// Constructs a <see cref="AttributeDictionary"/> based on the <paramref name="input"/> data and confirms that <see cref=
143+
/// "AttributeDictionary.GetUri(String)"/> returns the expected value.
144144
/// </summary>
145145
/// <param name="input">The value to add to the dictionary.</param>
146146
[Theory]
147147
[InlineData("https://www.github.com/OnTopicCMS")]
148148
[InlineData("Some:\\\\URL")]
149149
public void GetUri_ReturnsExpectedValue(string input) {
150150

151-
var attributes = new AttributeValueDictionary() {{"Key", input}};
151+
var attributes = new AttributeDictionary() {{"Key", input}};
152152

153153
Assert.Equal(new Uri(input), attributes.GetUri("Key"));
154154

@@ -158,13 +158,13 @@ public void GetUri_ReturnsExpectedValue(string input) {
158158
| TEST: GET {TYPE}: INVALID KEY: RETURNS NULL
159159
\-------------------------------------------------------------------------------------------------------------------------*/
160160
/// <summary>
161-
/// Constructs a <see cref="AttributeValueDictionary"/> and confirms that each of the <see cref="AttributeValueDictionary.
162-
/// GetValue(String)"/> methods return <c>null</c> if an invalid key is passed.
161+
/// Constructs a <see cref="AttributeDictionary"/> and confirms that each of the <see cref="AttributeDictionary.GetValue(
162+
/// String)"/> methods return <c>null</c> if an invalid key is passed.
163163
/// </summary>
164164
[Fact]
165165
public void GetType_InvalidKey_ReturnsNull() {
166166

167-
var attributes = new AttributeValueDictionary();
167+
var attributes = new AttributeDictionary();
168168

169169
Assert.Null(attributes.GetValue("MissingKey"));
170170
Assert.Null(attributes.GetBoolean("MissingKey"));
@@ -179,8 +179,8 @@ public void GetType_InvalidKey_ReturnsNull() {
179179
| TEST: AS ATTRIBUTE DICTIONARY: EXCLUDED KEYS: EXCLUDED
180180
\-------------------------------------------------------------------------------------------------------------------------*/
181181
/// <summary>
182-
/// Constructs a <see cref="AttributeValueDictionary"/> using <see cref="AttributeCollection.AsAttributeDictionary(Boolean
183-
/// )"/> and confirms that <see cref="AttributeValueDictionary.GetValue(String)"/> doesn't include the excluded values.
182+
/// Constructs a <see cref="AttributeDictionary"/> using <see cref="AttributeCollection.AsAttributeDictionary(Boolean)"/>
183+
/// and confirms that <see cref="AttributeDictionary.GetValue(String)"/> doesn't include the excluded values.
184184
/// </summary>
185185
[Fact]
186186
public void AsAttributeDictionary_ExcludedKeys_Excluded() {
@@ -204,8 +204,8 @@ public void AsAttributeDictionary_ExcludedKeys_Excluded() {
204204
| TEST: AS ATTRIBUTE DICTIONARY: INHERIT FROM BASE: INHERITS VALUES
205205
\-------------------------------------------------------------------------------------------------------------------------*/
206206
/// <summary>
207-
/// Constructs a <see cref="AttributeValueDictionary"/> using <see cref="AttributeCollection.AsAttributeDictionary(Boolean
208-
/// )"/> and confirms that <see cref="AttributeValueDictionary.GetValue(String)"/> correctly inherits values.
207+
/// Constructs a <see cref="AttributeDictionary"/> using <see cref="AttributeCollection.AsAttributeDictionary(Boolean)"/>
208+
/// and confirms that <see cref="AttributeDictionary.GetValue(String)"/> correctly inherits values.
209209
/// </summary>
210210
[Fact]
211211
public void AsAttributeDictionary_InheritFromBase_InheritsValues() {

OnTopic.Tests/TopicMappingServiceTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ public TopicMappingServiceTest(TopicInfrastructureFixture<StubTopicRepository> f
7373
/// <remarks>
7474
/// <para>
7575
/// The <see cref="TopicMappingService"/> includes functionality to map properties to attributes via a constructor that
76-
/// accepts a <see cref="AttributeValueDictionary"/>. This introduces some overhead which is not cost effective if there
77-
/// are not any attributes that map to properties. For larger numbers of mapped attributes, however, the <see cref="
78-
/// AttributeValueDictionary"/> can reduce the mapping time considerably, while also giving more control over the model
76+
/// accepts a <see cref="AttributeDictionary"/>. This introduces some overhead which is not cost effective if there are
77+
/// not any attributes that map to properties. For larger numbers of mapped attributes, however, the <see cref="
78+
/// AttributeDictionary"/> can reduce the mapping time considerably, while also giving more control over the model
7979
/// construction to the model developer. This test is intended to help identify and optimize that threshold based on
80-
/// improvements to the underlying <see cref="AttributeValueDictionary"/>, <see cref="TopicMappingService.MapAsync(
81-
/// Topic?, AssociationTypes)"/>, and <see cref="AttributeCollection.AsAttributeDictionary(bool)"/> convenience method.
80+
/// improvements to the underlying <see cref="AttributeDictionary"/>, <see cref="TopicMappingService.MapAsync(Topic?,
81+
/// AssociationTypes)"/>, and <see cref="AttributeCollection.AsAttributeDictionary(bool)"/> convenience method.
8282
/// </para>
8383
/// <para>
8484
/// This is only intended to be enabled when needed for specialized performance testing.
@@ -286,7 +286,7 @@ public async Task Map_Generic_ReturnsConvertedProperty() {
286286
\-------------------------------------------------------------------------------------------------------------------------*/
287287
/// <summary>
288288
/// Establishes a <see cref="TopicMappingService"/> and attempts to map a view model with a constructor containing a <see
289-
/// cref="AttributeValueDictionary"/>. Confirms that the expected model is returned.
289+
/// cref="AttributeDictionary"/>. Confirms that the expected model is returned.
290290
/// </summary>
291291
[Fact]
292292
public async Task Map_AttributeDictionary_ReturnsNewModel() {
@@ -306,7 +306,7 @@ public async Task Map_AttributeDictionary_ReturnsNewModel() {
306306
topic.Attributes.SetValue("UnmappedProperty", "Unmapped Value");
307307
topic.VersionHistory.Add(lastModified);
308308

309-
var target = await _mappingService.MapAsync<AttributeValueDictionaryConstructorTopicViewModel>(topic).ConfigureAwait(false);
309+
var target = await _mappingService.MapAsync<AttributeDictionaryConstructorTopicViewModel>(topic).ConfigureAwait(false);
310310

311311
Assert.Equal("Value", target?.Title);
312312
Assert.Equal("Short Title", target?.ShortTitle);

OnTopic.Tests/ViewModels/AttributeValueDictionaryConstructorTopicViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace OnTopic.Tests.ViewModels {
1010
| VIEW MODEL: ATTRIBUTE DICTIONARY CONSTRUCTOR
1111
\---------------------------------------------------------------------------------------------------------------------------*/
1212
/// <summary>
13-
/// Provides a strongly-typed data transfer object for testing a constructor with a <see cref="AttributeValueDictionary"/>.
13+
/// Provides a strongly-typed data transfer object for testing a constructor with a <see cref="AttributeDictionary"/>.
1414
/// </summary>
1515
/// <remarks>
1616
/// This is a sample class intended for test purposes only; it is not designed for use in a production environment.
@@ -25,7 +25,7 @@ public record AttributeValueDictionaryConstructorTopicViewModel: PageTopicViewMo
2525
/// /> dictionary.
2626
/// </summary>
2727
/// <param name="attributes">An <see cref="AttributeValueDictionaryConstructorTopicViewModel"/> of attribute values.</param>
28-
public AttributeValueDictionaryConstructorTopicViewModel(AttributeValueDictionary attributes) : base(attributes) {
28+
public AttributeValueDictionaryConstructorTopicViewModel(AttributeDictionary attributes) : base(attributes) {
2929
Contract.Requires(attributes, nameof(attributes));
3030
MappedProperty = attributes.GetValue(nameof(MappedProperty));
3131
}

OnTopic.Tests/ViewModels/LoadTestingViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public class LoadTestingViewModel: KeyOnlyTopicViewModel {
2525
/// <summary>
2626
/// Initializes a new <see cref="LoadTestingViewModel"/> with an <paramref name="attributes"/> dictionary.
2727
/// </summary>
28-
/// <param name="attributes">An <see cref="AttributeValueDictionary"/> of attribute values.</param>
29-
public LoadTestingViewModel(AttributeValueDictionary attributes) {
28+
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
29+
public LoadTestingViewModel(AttributeDictionary attributes) {
3030
Contract.Requires(attributes);
3131
Property0 = attributes.GetInteger("Property0");
3232
Property1 = attributes.GetInteger("Property1");

OnTopic.ViewModels/TopicViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public record TopicViewModel: ITopicViewModel, ICoreTopicViewModel, IAssociatedT
2626
/// <summary>
2727
/// Initializes a new <see cref="TopicViewModel"/> with an <paramref name="attributes"/> dictionary.
2828
/// </summary>
29-
/// <param name="attributes">An <see cref="AttributeValueDictionary"/> of attribute values.</param>
30-
public TopicViewModel(AttributeValueDictionary attributes) {
29+
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
30+
public TopicViewModel(AttributeDictionary attributes) {
3131
Contract.Requires(attributes, nameof(attributes));
3232
IsHidden = attributes.GetBoolean("IsHidden")?? IsHidden;
3333
View = attributes.GetValue("View");

OnTopic.ViewModels/_contentTypes/ContentListTopicViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public record ContentListTopicViewModel: PageTopicViewModel {
2525
/// <summary>
2626
/// Initializes a new <see cref="ContentListTopicViewModel"/> with an <paramref name="attributes"/> dictionary.
2727
/// </summary>
28-
/// <param name="attributes">An <see cref="AttributeValueDictionary"/> of attribute values.</param>
29-
public ContentListTopicViewModel(AttributeValueDictionary attributes): base(attributes) {
28+
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
29+
public ContentListTopicViewModel(AttributeDictionary attributes): base(attributes) {
3030
Contract.Requires(attributes, nameof(attributes));
3131
IsIndexed = attributes.GetBoolean(nameof(IsIndexed))?? IsIndexed;
3232
IndexLabel = attributes.GetValue(nameof(IndexLabel))?? IndexLabel;

OnTopic.ViewModels/_contentTypes/IndexTopicViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public record IndexTopicViewModel: PageTopicViewModel {
2525
/// <summary>
2626
/// Initializes a new <see cref="IndexTopicViewModel"/> with an <paramref name="attributes"/> dictionary.
2727
/// </summary>
28-
/// <param name="attributes">An <see cref="AttributeValueDictionary"/> of attribute values.</param>
29-
public IndexTopicViewModel(AttributeValueDictionary attributes): base(attributes) { }
28+
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
29+
public IndexTopicViewModel(AttributeDictionary attributes): base(attributes) { }
3030

3131
/// <summary>
3232
/// Initializes a new <see cref="IndexTopicViewModel"/> with no parameters.

OnTopic.ViewModels/_contentTypes/PageGroupTopicViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public record PageGroupTopicViewModel : SectionTopicViewModel {
2525
/// <summary>
2626
/// Initializes a new <see cref="PageGroupTopicViewModel"/> with an <paramref name="attributes"/> dictionary.
2727
/// </summary>
28-
/// <param name="attributes">An <see cref="AttributeValueDictionary"/> of attribute values.</param>
29-
public PageGroupTopicViewModel(AttributeValueDictionary attributes): base(attributes) { }
28+
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
29+
public PageGroupTopicViewModel(AttributeDictionary attributes): base(attributes) { }
3030

3131
/// <summary>
3232
/// Initializes a new <see cref="PageGroupTopicViewModel"/> with no parameters.

OnTopic.ViewModels/_contentTypes/PageTopicViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public record PageTopicViewModel: TopicViewModel, INavigableTopicViewModel {
2525
/// <summary>
2626
/// Initializes a new <see cref="PageTopicViewModel"/> with an <paramref name="attributes"/> dictionary.
2727
/// </summary>
28-
/// <param name="attributes">An <see cref="AttributeValueDictionary"/> of attribute values.</param>
29-
public PageTopicViewModel(AttributeValueDictionary attributes): base(attributes) {
28+
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
29+
public PageTopicViewModel(AttributeDictionary attributes): base(attributes) {
3030
Contract.Requires(attributes, nameof(attributes));
3131
ShortTitle = attributes.GetValue(nameof(ShortTitle));
3232
Subtitle = attributes.GetValue(nameof(Subtitle));

0 commit comments

Comments
 (0)