@@ -10,29 +10,29 @@ public class AppConfigurationFactoryTests
10
10
public void ShouldMapFromAppConfiguration ( )
11
11
{
12
12
var inMemorySettings = new Dictionary < string , string >
13
- {
14
- { "BlogName" , "UnitTest" } ,
15
- { "BlogBrandUrl" , "http://localhost" } ,
16
- { "Social:GithubAccountUrl" , "github" } ,
17
- { "Social:LinkedInAccountUrl" , "linkedIn" } ,
18
- { "Social:TwitterAccountUrl" , "twitter" } ,
19
- { "ConnectionString" , "cs" } ,
20
- { "DatabaseName" , "db" } ,
21
- { "Introduction:BackgroundUrl" , "someurl" } ,
22
- { "Introduction:ProfilePictureUrl" , "anotherurl" } ,
23
- { "Introduction:Description" , "desc" } ,
24
- { "BlogPostsPerPage" , "5" } ,
25
- { "AboutMeProfileInformation:Name" , "Steven" } ,
26
- { "AboutMeProfileInformation:Heading" , "Dev" } ,
27
- { "AboutMeProfileInformation:ProfilePictureUrl" , "Url" } ,
28
- { "Giscus:Repository" , "repo" } ,
29
- { "Giscus:RepositoryId" , "repoid" } ,
30
- { "Giscus:Category" , "general" } ,
31
- { "Giscus:CategoryId" , "generalid" } ,
32
- { "Disqus:Shortname" , "blog" } ,
33
- { "KofiToken" , "ABC" } ,
34
- { "GithubSponsorName" , "linkdotnet" } ,
35
- } ;
13
+ {
14
+ { "BlogName" , "UnitTest" } ,
15
+ { "BlogBrandUrl" , "http://localhost" } ,
16
+ { "Social:GithubAccountUrl" , "github" } ,
17
+ { "Social:LinkedInAccountUrl" , "linkedIn" } ,
18
+ { "Social:TwitterAccountUrl" , "twitter" } ,
19
+ { "ConnectionString" , "cs" } ,
20
+ { "DatabaseName" , "db" } ,
21
+ { "Introduction:BackgroundUrl" , "someurl" } ,
22
+ { "Introduction:ProfilePictureUrl" , "anotherurl" } ,
23
+ { "Introduction:Description" , "desc" } ,
24
+ { "BlogPostsPerPage" , "5" } ,
25
+ { "AboutMeProfileInformation:Name" , "Steven" } ,
26
+ { "AboutMeProfileInformation:Heading" , "Dev" } ,
27
+ { "AboutMeProfileInformation:ProfilePictureUrl" , "Url" } ,
28
+ { "Giscus:Repository" , "repo" } ,
29
+ { "Giscus:RepositoryId" , "repoid" } ,
30
+ { "Giscus:Category" , "general" } ,
31
+ { "Giscus:CategoryId" , "generalid" } ,
32
+ { "Disqus:Shortname" , "blog" } ,
33
+ { "KofiToken" , "ABC" } ,
34
+ { "GithubSponsorName" , "linkdotnet" } ,
35
+ } ;
36
36
var configuration = new ConfigurationBuilder ( )
37
37
. AddInMemoryCollection ( inMemorySettings )
38
38
. Build ( ) ;
@@ -80,15 +80,14 @@ public void ShouldSetGithubLinkedAccountAccordingToValueSet(
80
80
bool twitterAvailable )
81
81
{
82
82
var inMemorySettings = new Dictionary < string , string >
83
- {
84
- { "Introduction:BackgroundUrl" , "someurl" } ,
85
- { "Introduction:ProfilePictureUrl" , "anotherurl" } ,
86
- { "Introduction:Description" , "desc" } ,
87
- { "Social:GithubAccountUrl" , githubUrl } ,
88
- { "Social:LinkedInAccountUrl" , linkedInUrl } ,
89
- { "Social:TwitterAccountUrl" , twitterUrl } ,
90
- { "BlogPostsPerPage" , "2" } ,
91
- } ;
83
+ {
84
+ { "Introduction:BackgroundUrl" , "someurl" } ,
85
+ { "Introduction:ProfilePictureUrl" , "anotherurl" } ,
86
+ { "Introduction:Description" , "desc" } ,
87
+ { "Social:GithubAccountUrl" , githubUrl } ,
88
+ { "Social:LinkedInAccountUrl" , linkedInUrl } ,
89
+ { "Social:TwitterAccountUrl" , twitterUrl } ,
90
+ } ;
92
91
var configuration = new ConfigurationBuilder ( )
93
92
. AddInMemoryCollection ( inMemorySettings )
94
93
. Build ( ) ;
@@ -104,12 +103,11 @@ public void ShouldSetGithubLinkedAccountAccordingToValueSet(
104
103
public void ShouldSetIsAboutMeEnabledToFalseWhenNoInformation ( )
105
104
{
106
105
var inMemorySettings = new Dictionary < string , string >
107
- {
108
- { "Introduction:BackgroundUrl" , "someurl" } ,
109
- { "Introduction:ProfilePictureUrl" , "anotherurl" } ,
110
- { "Introduction:Description" , "desc" } ,
111
- { "BlogPostsPerPage" , "2" } ,
112
- } ;
106
+ {
107
+ { "Introduction:BackgroundUrl" , "someurl" } ,
108
+ { "Introduction:ProfilePictureUrl" , "anotherurl" } ,
109
+ { "Introduction:Description" , "desc" } ,
110
+ } ;
113
111
var configuration = new ConfigurationBuilder ( )
114
112
. AddInMemoryCollection ( inMemorySettings )
115
113
. Build ( ) ;
@@ -123,12 +121,11 @@ public void ShouldSetIsAboutMeEnabledToFalseWhenNoInformation()
123
121
public void ShouldSetCommentPluginsToFalseWhenNoInformation ( )
124
122
{
125
123
var inMemorySettings = new Dictionary < string , string >
126
- {
127
- { "Introduction:BackgroundUrl" , "someurl" } ,
128
- { "Introduction:ProfilePictureUrl" , "anotherurl" } ,
129
- { "Introduction:Description" , "desc" } ,
130
- { "BlogPostsPerPage" , "2" } ,
131
- } ;
124
+ {
125
+ { "Introduction:BackgroundUrl" , "someurl" } ,
126
+ { "Introduction:ProfilePictureUrl" , "anotherurl" } ,
127
+ { "Introduction:Description" , "desc" } ,
128
+ } ;
132
129
var configuration = new ConfigurationBuilder ( )
133
130
. AddInMemoryCollection ( inMemorySettings )
134
131
. Build ( ) ;
@@ -138,4 +135,16 @@ public void ShouldSetCommentPluginsToFalseWhenNoInformation()
138
135
appConfiguration . IsGiscusEnabled . Should ( ) . BeFalse ( ) ;
139
136
appConfiguration . IsDisqusEnabled . Should ( ) . BeFalse ( ) ;
140
137
}
138
+
139
+ [ Fact ]
140
+ public void ShouldSetDefaultBlogPostPerPageIfNotSet ( )
141
+ {
142
+ var configuration = new ConfigurationBuilder ( )
143
+ . AddInMemoryCollection ( new Dictionary < string , string > ( ) )
144
+ . Build ( ) ;
145
+
146
+ var appConfiguration = AppConfigurationFactory . Create ( configuration ) ;
147
+
148
+ appConfiguration . BlogPostsPerPage . Should ( ) . Be ( 10 ) ;
149
+ }
141
150
}
0 commit comments