Skip to content

Commit d3e70d0

Browse files
committed
Merge branch 'maintenance/code-analysis' into develop
A few unaddressed warnings from Code Analysis had crept in during the 5.0.1 updates, which have been addressed as part of this update.
2 parents dc6b8ad + 1723794 commit d3e70d0

5 files changed

Lines changed: 13 additions & 4 deletions

File tree

OnTopic.AspNetCore.Mvc.Tests/ValidateTopicAttributeTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public static ActionExecutingContext GetActionExecutingContext(Controller contro
6363
/// <summary>
6464
/// Generates a barebones <see cref="ControllerContext"/> for testing a controller.
6565
/// </summary>
66+
#pragma warning disable CA1024 // Use properties where appropriate
6667
public static ControllerContext GetControllerContext() =>
6768
new(
6869
new() {
@@ -71,6 +72,7 @@ public static ControllerContext GetControllerContext() =>
7172
ActionDescriptor = new ControllerActionDescriptor()
7273
}
7374
);
75+
#pragma warning restore CA1024 // Use properties where appropriate
7476

7577
/*==========================================================================================================================
7678
| METHOD: GET TOPIC CONTROLLER

OnTopic.Tests/AttributeCollectionTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,9 @@ public void SetValue_ValueChanged_IsDirty() {
449449
[Fact]
450450
public void Clear_NonNullableValueWithBusinessLogic_ThrowsException() {
451451

452-
var topic = new CustomTopic("Test", "Page");
453-
454-
topic.NonNullableAttribute = "Test";
452+
var topic = new CustomTopic("Test", "Page") {
453+
NonNullableAttribute = "Test"
454+
};
455455

456456
Assert.Throws<ArgumentNullException>(() =>
457457
topic.Attributes.Clear()

OnTopic.Tests/Fixtures/SharedRepositoryCollection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
using OnTopic.TestDoubles;
77
using Xunit;
88

9+
#pragma warning disable CA1711 // Identifiers should not have incorrect suffix
10+
911
namespace OnTopic.Tests.Fixtures {
1012

1113
/*============================================================================================================================
@@ -20,3 +22,5 @@ public class SharedRepositoryCollection: ICollectionFixture<TopicInfrastructureF
2022

2123
}
2224
}
25+
26+
#pragma warning restore CA1711 // Identifiers should not have incorrect suffix

OnTopic.Tests/TopicMappingServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ public async Task Map_AlternateRelationship_ReturnsCorrectRelationship() {
680680
[Fact]
681681
public async Task Map_CustomCollection_ReturnsCollection() {
682682

683-
var topic = (ContentTypeDescriptor)_topicRepository.Load("Root:Configuration:ContentTypes:Page");
683+
var topic = (ContentTypeDescriptor?)_topicRepository.Load("Root:Configuration:ContentTypes:Page");
684684
var target = await _mappingService.MapAsync<ContentTypeDescriptorTopicViewModel>(topic).ConfigureAwait(false);
685685

686686
Assert.Equal<int?>(8, target?.AttributeDescriptors.Count);

OnTopic.Tests/ViewModels/MethodBasedReferenceViewModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ public class MethodBasedReferenceViewModel {
2121
private TopicViewModel? _methodValue;
2222

2323
public void SetMethod(TopicViewModel? methodValue) => _methodValue = methodValue;
24+
25+
#pragma warning disable CA1024 // Use properties where appropriate
2426
public TopicViewModel? GetMethod() => _methodValue;
27+
#pragma warning restore CA1024 // Use properties where appropriate
2528

2629
} //Class
2730
} //Namespace

0 commit comments

Comments
 (0)