|
11 | 11 | using OnTopic.Tests.BindingModels; |
12 | 12 | using OnTopic.Tests.Fixtures; |
13 | 13 | using OnTopic.Tests.ViewModels; |
| 14 | +using OnTopic.Tests.ViewModels.Metadata; |
14 | 15 | using Xunit; |
15 | 16 |
|
16 | 17 | namespace OnTopic.Tests { |
@@ -625,6 +626,27 @@ public void SetMethodValue_NullReferenceValue_DoesNotSetValue() { |
625 | 626 |
|
626 | 627 | } |
627 | 628 |
|
| 629 | + /*========================================================================================================================== |
| 630 | + | TEST: MAYBE COMPATIBLE: CORRESPONDING TOPIC: CORRECTLY SET |
| 631 | + \-------------------------------------------------------------------------------------------------------------------------*/ |
| 632 | + /// <summary> |
| 633 | + /// Establishes a <see cref="TypeAccessor"/> and based on the <see cref="ContentTypeDescriptorTopicViewModel"/> and |
| 634 | + /// confirms that the underlying <see cref="MemberAccessor"/> instances are correctly marked as <see cref="ItemMetadata. |
| 635 | + /// MaybeCompatible"/> based on the association with the <see cref="ContentTypeDescriptor"/>. |
| 636 | + /// </summary> |
| 637 | + [Fact] |
| 638 | + public void MaybeCompatible_CorrespondingTopic_CorrectlySet() { |
| 639 | + |
| 640 | + var typeAccessor = TypeAccessorCache.GetTypeAccessor<CustomTopicTopicViewModel>(); |
| 641 | + |
| 642 | + Assert.Equal(9, typeAccessor.GetMembers(MemberTypes.Property).Count(m => m.MaybeCompatible)); |
| 643 | + Assert.Equal(2, typeAccessor.GetMembers(MemberTypes.Property).Count(m => !m.MaybeCompatible)); |
| 644 | + Assert.Equal(9, typeAccessor.ConstructorParameters.Count(m => m.MaybeCompatible)); |
| 645 | + Assert.Equal(2, typeAccessor.ConstructorParameters.Count(m => !m.MaybeCompatible)); |
| 646 | + Assert.True(typeAccessor.GetMember(nameof(CustomTopicTopicViewModel.TopicReference))?.MaybeCompatible); |
| 647 | + |
| 648 | + } |
| 649 | + |
628 | 650 | /*========================================================================================================================== |
629 | 651 | | TEST: SET PROPERTY VALUE: REFLECTION PERFORMANCE |
630 | 652 | \-------------------------------------------------------------------------------------------------------------------------*/ |
|
0 commit comments