1
1
using System . Data . Common ;
2
2
using System . Linq ;
3
3
using LinkDotNet . Blog . Domain ;
4
- using LinkDotNet . Blog . Infrastructure . Persistence ;
5
- using LinkDotNet . Blog . Infrastructure . Persistence . Sql ;
6
4
using LinkDotNet . Blog . Web ;
7
5
using LinkDotNet . Blog . Web . Features . Admin . Dashboard ;
8
6
using LinkDotNet . Blog . Web . Features . Admin . Dashboard . Components ;
9
7
using LinkDotNet . Blog . Web . Features . Admin . Dashboard . Services ;
10
8
using Microsoft . Data . Sqlite ;
11
- using Microsoft . EntityFrameworkCore ;
12
9
using Microsoft . Extensions . DependencyInjection ;
13
10
14
11
namespace LinkDotNet . Blog . UnitTests . Web . Features . Admin . Dashboard ;
@@ -20,15 +17,11 @@ public class DashboardPageTests : TestContext
20
17
[ InlineData ( false ) ]
21
18
public void ShouldShowAboutMeStatisticsAccordingToConfig ( bool aboutMeEnabled )
22
19
{
23
- var options = new DbContextOptionsBuilder ( )
24
- . UseSqlite ( CreateInMemoryConnection ( ) )
25
- . Options ;
20
+ ComponentFactories . AddStub < VisitCountPerPage > ( ) ;
26
21
var dashboardService = new Mock < IDashboardService > ( ) ;
27
22
this . AddTestAuthorization ( ) . SetAuthorized ( "test" ) ;
28
23
Services . AddScoped ( _ => CreateAppConfiguration ( aboutMeEnabled ) ) ;
29
24
Services . AddScoped ( _ => dashboardService . Object ) ;
30
- Services . AddScoped ( _ => Mock . Of < IRepository < BlogPost > > ( ) ) ;
31
- Services . AddScoped ( _ => new BlogDbContext ( options ) ) ;
32
25
dashboardService . Setup ( d => d . GetDashboardDataAsync ( ) )
33
26
. ReturnsAsync ( new DashboardData ( ) ) ;
34
27
0 commit comments