File tree Expand file tree Collapse file tree 25 files changed +245
-289
lines changed
Expand file tree Collapse file tree 25 files changed +245
-289
lines changed Original file line number Diff line number Diff line change 1+ namespace CommunityToolkit . Maui . Core ;
2+
3+ static class MultiValidationBehaviorDefaults
4+ {
5+ public static List < object ? > ? Errors { get ; } = null ;
6+ public static List < object ? > ? Error { get ; } = null ;
7+ }
Original file line number Diff line number Diff line change 1+ namespace CommunityToolkit . Maui . Core ;
2+
3+ static class NumericValidationBehaviorDefaults
4+ {
5+ public const double MinimumValue = double . NegativeInfinity ;
6+ public const double MaximumValue = double . PositiveInfinity ;
7+ public const int MinimumDecimalPlaces = 0 ;
8+ public const int MaximumDecimalPlaces = int . MaxValue ;
9+ }
Original file line number Diff line number Diff line change 1+ namespace CommunityToolkit . Maui . Core ;
2+
3+ static class RequiredStringValidationBehaviorDefaults
4+ {
5+ public const string ? RequiredString = null ;
6+ public const bool ExactMatch = true ;
7+ }
Original file line number Diff line number Diff line change 1+ namespace CommunityToolkit . Maui . Core ;
2+
3+ static class UriValidationBehaviorDefaults
4+ {
5+ public static UriKind UriKind { get ; } = UriKind . RelativeOrAbsolute ;
6+ }
Original file line number Diff line number Diff line change 11using CommunityToolkit . Maui . Behaviors ;
2+ using CommunityToolkit . Maui . Core ;
23using Nito . AsyncEx ;
34using Xunit ;
45
@@ -125,4 +126,14 @@ public void EnsureObjectDisposedExceptionThrownWhenDisposedBehaviorAttachedToVis
125126 } ) ;
126127 } ) ;
127128 }
129+
130+ [ Fact ]
131+ public void VerifyDefaults ( )
132+ {
133+ var charactersValidationBehavior = new CharactersValidationBehavior ( ) ;
134+
135+ Assert . Equal ( CharactersValidationBehaviorDefaults . CharacterType , charactersValidationBehavior . CharacterType ) ;
136+ Assert . Equal ( CharactersValidationBehaviorDefaults . MaximumCharacterTypeCount , charactersValidationBehavior . MaximumCharacterTypeCount ) ;
137+ Assert . Equal ( CharactersValidationBehaviorDefaults . MinimumCharacterTypeCount , charactersValidationBehavior . MinimumCharacterTypeCount ) ;
138+ }
128139}
Original file line number Diff line number Diff line change 11using CommunityToolkit . Maui . Behaviors ;
2+ using CommunityToolkit . Maui . Core ;
23using Xunit ;
34
45namespace CommunityToolkit . Maui . UnitTests . Behaviors ;
@@ -119,4 +120,15 @@ public async Task ForceValidateCancellationTokenCanceled()
119120 // Assert
120121 await Assert . ThrowsAsync < OperationCanceledException > ( async ( ) => await multiBehavior . ForceValidate ( cts . Token ) ) ;
121122 }
123+
124+ [ Fact ]
125+ public void VerifyDefaults ( )
126+ {
127+ // Arrange
128+ var multiValidationBehavior = new MultiValidationBehavior ( ) ;
129+
130+ // Act // Assert
131+ Assert . Equal ( MultiValidationBehaviorDefaults . Errors , multiValidationBehavior . Errors ) ;
132+ Assert . Equal ( MultiValidationBehaviorDefaults . Error , MultiValidationBehavior . GetError ( multiValidationBehavior ) ) ;
133+ }
122134}
Original file line number Diff line number Diff line change 11using System . Globalization ;
22using CommunityToolkit . Maui . Behaviors ;
3+ using CommunityToolkit . Maui . Core ;
34using FluentAssertions ;
45using Xunit ;
56
@@ -163,4 +164,17 @@ await Assert.ThrowsAsync<OperationCanceledException>(async () =>
163164 await behavior . ForceValidate ( cts . Token ) ;
164165 } ) ;
165166 }
167+
168+ [ Fact ]
169+ public void VerifyDefaults ( )
170+ {
171+ // Arrange
172+ var numericValidationBehavior = new NumericValidationBehavior ( ) ;
173+
174+ // Act Assert
175+ Assert . Equal ( NumericValidationBehaviorDefaults . MaximumDecimalPlaces , numericValidationBehavior . MaximumDecimalPlaces ) ;
176+ Assert . Equal ( NumericValidationBehaviorDefaults . MaximumValue , numericValidationBehavior . MaximumValue ) ;
177+ Assert . Equal ( NumericValidationBehaviorDefaults . MinimumDecimalPlaces , numericValidationBehavior . MinimumDecimalPlaces ) ;
178+ Assert . Equal ( NumericValidationBehaviorDefaults . MinimumValue , numericValidationBehavior . MinimumValue ) ;
179+ }
166180}
Original file line number Diff line number Diff line change 11using System . Globalization ;
22using CommunityToolkit . Maui . Behaviors ;
3+ using CommunityToolkit . Maui . Core ;
34using Xunit ;
45
56namespace CommunityToolkit . Maui . UnitTests . Behaviors ;
@@ -157,4 +158,15 @@ public void IsValidFalseWhenEnterDifferentText_Test()
157158 // Assert
158159 Assert . False ( confirmPasswordBehavior . IsValid ) ;
159160 }
161+
162+ [ Fact ]
163+ public void VerifyDefaults ( )
164+ {
165+ // Arrange
166+ var requiredStringValidationBehavior = new RequiredStringValidationBehavior ( ) ;
167+
168+ // Act Assert
169+ Assert . Equal ( RequiredStringValidationBehaviorDefaults . ExactMatch , requiredStringValidationBehavior . ExactMatch ) ;
170+ Assert . Equal ( RequiredStringValidationBehaviorDefaults . RequiredString , requiredStringValidationBehavior . RequiredString ) ;
171+ }
160172}
Original file line number Diff line number Diff line change @@ -84,4 +84,18 @@ await Assert.ThrowsAsync<OperationCanceledException>(async () =>
8484 await behavior . ForceValidate ( cts . Token ) ;
8585 } ) ;
8686 }
87+
88+ [ Fact ]
89+ public void VerifyDefaults ( )
90+ {
91+ // Arrange
92+ var textValidationBehavior = new TextValidationBehavior ( ) ;
93+
94+ // Act Assert
95+ Assert . Equal ( TextValidationBehaviorDefaults . DecorationFlags , textValidationBehavior . DecorationFlags ) ;
96+ Assert . Equal ( TextValidationBehaviorDefaults . MaximumLength , textValidationBehavior . MaximumLength ) ;
97+ Assert . Equal ( TextValidationBehaviorDefaults . MinimumLength , textValidationBehavior . MinimumLength ) ;
98+ Assert . Equal ( TextValidationBehaviorDefaults . RegexOptions , textValidationBehavior . RegexOptions ) ;
99+ Assert . Equal ( TextValidationBehaviorDefaults . RegexPattern , textValidationBehavior . RegexPattern ) ;
100+ }
87101}
Original file line number Diff line number Diff line change 11using CommunityToolkit . Maui . Behaviors ;
2+ using CommunityToolkit . Maui . Core ;
23using Xunit ;
34
45namespace CommunityToolkit . Maui . UnitTests . Behaviors ;
@@ -75,4 +76,14 @@ await Assert.ThrowsAsync<OperationCanceledException>(async () =>
7576 await behavior . ForceValidate ( cts . Token ) ;
7677 } ) ;
7778 }
79+
80+ [ Fact ]
81+ public void VerifyDefaults ( )
82+ {
83+ // Arrange
84+ var behavior = new UriValidationBehavior ( ) ;
85+
86+ // Act Assert
87+ Assert . Equal ( UriValidationBehaviorDefaults . UriKind , behavior . UriKind ) ;
88+ }
7889}
You can’t perform that action at this time.
0 commit comments