Skip to content

Commit f38e068

Browse files
committed
New Repository for profile information
1 parent 64d8dc6 commit f38e068

31 files changed

+257
-88
lines changed

LinkDotNet.Blog.IntegrationTests/SqlDatabaseTestBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ protected SqlDatabaseTestBase()
1515
var options = new DbContextOptionsBuilder()
1616
.UseSqlite(CreateInMemoryConnection())
1717
.Options;
18-
DbContext = new BlogPostContext(options);
19-
BlogPostRepository = new BlogPostRepository(new BlogPostContext(options));
18+
DbContext = new BlogDbContext(options);
19+
BlogPostRepository = new BlogPostRepository(new BlogDbContext(options));
2020
}
2121

2222
protected BlogPostRepository BlogPostRepository { get; }
2323

24-
protected BlogPostContext DbContext { get; }
24+
protected BlogDbContext DbContext { get; }
2525

2626
public Task InitializeAsync()
2727
{

LinkDotNet.Blog.IntegrationTests/Web/Pages/Admin/DraftBlogPostPageTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public async Task ShouldOnlyShowPublishedPosts()
2222
await BlogPostRepository.StoreAsync(unpublishedPost);
2323
using var ctx = new TestContext();
2424
ctx.JSInterop.Mode = JSRuntimeMode.Loose;
25-
ctx.Services.AddScoped<IRepository>(_ => BlogPostRepository);
25+
ctx.Services.AddScoped<IBlogPostRepository>(_ => BlogPostRepository);
2626
var cut = ctx.RenderComponent<DraftBlogPosts>();
2727
cut.WaitForState(() => cut.FindAll(".blog-card").Any());
2828

LinkDotNet.Blog.IntegrationTests/Web/Pages/BlogPostPageTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public async Task ShouldSetTagsWhenAvailable()
8080

8181
private void RegisterComponents(TestContextBase ctx, ILocalStorageService localStorageService = null)
8282
{
83-
ctx.Services.AddScoped<IRepository>(_ => BlogPostRepository);
83+
ctx.Services.AddScoped<IBlogPostRepository>(_ => BlogPostRepository);
8484
ctx.Services.AddScoped(_ => localStorageService ?? new Mock<ILocalStorageService>().Object);
8585
ctx.Services.AddScoped(_ => new Mock<IToastService>().Object);
8686
ctx.Services.AddScoped(_ => new Mock<IHeadElementHelper>().Object);

LinkDotNet.Blog.IntegrationTests/Web/Pages/IndexTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private async Task CreatePublishedBlogPosts(int amount)
132132

133133
private void RegisterComponents(TestContextBase ctx)
134134
{
135-
ctx.Services.AddScoped<IRepository>(_ => BlogPostRepository);
135+
ctx.Services.AddScoped<IBlogPostRepository>(_ => BlogPostRepository);
136136
ctx.Services.AddScoped(_ => CreateSampleAppConfiguration());
137137
ctx.Services.AddScoped(_ => new Mock<IHeadElementHelper>().Object);
138138
}

LinkDotNet.Blog.IntegrationTests/Web/Pages/SearchByTagTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public async Task ShouldOnlyDisplayTagsGivenByParameter()
2222
await AddBlogPostWithTagAsync("Tag 1");
2323
await AddBlogPostWithTagAsync("Tag 1");
2424
await AddBlogPostWithTagAsync("Tag 2");
25-
ctx.Services.AddScoped<IRepository>(_ => BlogPostRepository);
25+
ctx.Services.AddScoped<IBlogPostRepository>(_ => BlogPostRepository);
2626
ctx.Services.AddScoped(_ => new Mock<IHeadElementHelper>().Object);
2727
var cut = ctx.RenderComponent<SearchByTag>(p => p.Add(s => s.Tag, "Tag 1"));
2828
cut.WaitForState(() => cut.FindAll(".blog-card").Any());
@@ -37,7 +37,7 @@ public async Task ShouldHandleSpecialCharacters()
3737
{
3838
using var ctx = new TestContext();
3939
await AddBlogPostWithTagAsync("C#");
40-
ctx.Services.AddScoped<IRepository>(_ => BlogPostRepository);
40+
ctx.Services.AddScoped<IBlogPostRepository>(_ => BlogPostRepository);
4141
ctx.Services.AddScoped(_ => new Mock<IHeadElementHelper>().Object);
4242
var cut = ctx.RenderComponent<SearchByTag>(p => p.Add(s => s.Tag, Uri.EscapeDataString("C#")));
4343
cut.WaitForState(() => cut.FindAll(".blog-card").Any());

LinkDotNet.Blog.IntegrationTests/Web/Pages/SearchTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task ShouldFindBlogPostWhenTitleMatches()
2121
await BlogPostRepository.StoreAsync(blogPost1);
2222
await BlogPostRepository.StoreAsync(blogPost2);
2323
using var ctx = new TestContext();
24-
ctx.Services.AddScoped<IRepository>(_ => BlogPostRepository);
24+
ctx.Services.AddScoped<IBlogPostRepository>(_ => BlogPostRepository);
2525

2626
var cut = ctx.RenderComponent<Search>(p => p.Add(s => s.SearchTerm, "Title 1"));
2727

@@ -39,7 +39,7 @@ public async Task ShouldFindBlogPostWhenTagMatches()
3939
await BlogPostRepository.StoreAsync(blogPost1);
4040
await BlogPostRepository.StoreAsync(blogPost2);
4141
using var ctx = new TestContext();
42-
ctx.Services.AddScoped<IRepository>(_ => BlogPostRepository);
42+
ctx.Services.AddScoped<IBlogPostRepository>(_ => BlogPostRepository);
4343

4444
var cut = ctx.RenderComponent<Search>(p => p.Add(s => s.SearchTerm, "Cat"));
4545

@@ -55,7 +55,7 @@ public async Task ShouldUnescapeQuery()
5555
var blogPost1 = new BlogPostBuilder().WithTitle("Title 1").Build();
5656
await BlogPostRepository.StoreAsync(blogPost1);
5757
using var ctx = new TestContext();
58-
ctx.Services.AddScoped<IRepository>(_ => BlogPostRepository);
58+
ctx.Services.AddScoped<IBlogPostRepository>(_ => BlogPostRepository);
5959

6060
var cut = ctx.RenderComponent<Search>(p => p.Add(s => s.SearchTerm, "Title%201"));
6161

LinkDotNet.Blog.IntegrationTests/Web/Shared/Admin/BlogPostAdminActionsTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class BlogPostAdminActionsTests
1717
public void ShouldDeleteBlogPostWhenOkClicked()
1818
{
1919
const string blogPostId = "2";
20-
var repositoryMock = new Mock<IRepository>();
20+
var repositoryMock = new Mock<IBlogPostRepository>();
2121
using var ctx = new TestContext();
2222
ctx.AddTestAuthorization().SetAuthorized("s");
2323
ctx.Services.AddSingleton(repositoryMock.Object);
@@ -34,7 +34,7 @@ public void ShouldDeleteBlogPostWhenOkClicked()
3434
public void ShouldNotDeleteBlogPostWhenCancelClicked()
3535
{
3636
const string blogPostId = "2";
37-
var repositoryMock = new Mock<IRepository>();
37+
var repositoryMock = new Mock<IBlogPostRepository>();
3838
using var ctx = new TestContext();
3939
ctx.AddTestAuthorization().SetAuthorized("s");
4040
ctx.Services.AddSingleton(repositoryMock.Object);
@@ -51,7 +51,7 @@ public void ShouldNotDeleteBlogPostWhenCancelClicked()
5151
public void ShouldGoToEditPageOnEditClick()
5252
{
5353
const string blogPostId = "2";
54-
var repositoryMock = new Mock<IRepository>();
54+
var repositoryMock = new Mock<IBlogPostRepository>();
5555
using var ctx = new TestContext();
5656
ctx.AddTestAuthorization().SetAuthorized("s");
5757
ctx.Services.AddSingleton(repositoryMock.Object);

LinkDotNet.Blog.UnitTests/Infrastructure/Persistence/InMemory/InMemoryRepositoryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ namespace LinkDotNet.Blog.UnitTests.Infrastructure.Persistence.InMemory
99
{
1010
public class InMemoryRepositoryTests
1111
{
12-
private readonly InMemoryRepository sut;
12+
private readonly BlogPostRepository sut;
1313

1414
public InMemoryRepositoryTests()
1515
{
16-
sut = new InMemoryRepository();
16+
sut = new BlogPostRepository();
1717
}
1818

1919
[Fact]

LinkDotNet.Blog.Web/Pages/AboutMe.razor

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
<div class="container">
1111
<div class="row">
1212
<div class="col-lg-3 col-md-4">
13-
<Profile ProfileInformation="@appConfiguration.ProfileInformation"
14-
IsAuthenticated="@httpContextAccessor.HttpContext.User.Identity.IsAuthenticated"
15-
ProfileInformationEntries=""
16-
ProfileInformationCollectionChanged=""/>
13+
<Profile IsAuthenticated="@httpContextAccessor.HttpContext.User.Identity.IsAuthenticated"/>
1714
</div>
1815
<div class="col-lg-9 col-md-8 tab-container">
1916
<div class="row">

LinkDotNet.Blog.Web/Pages/Admin/CreateNewBlogPostPage.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@using LinkDotNet.Blog.Web.Shared.Admin
55
@using LinkDotNet.Domain
66
@inherits MarkdownComponentBase
7-
@inject IRepository repository
7+
@inject IBlogPostRepository blogPostRepository
88
@inject IToastService toastService
99

1010
<div class="page">
@@ -14,7 +14,7 @@
1414
@code {
1515
private async Task StoreBlogPostAsync(BlogPost blogPost)
1616
{
17-
await repository.StoreAsync(blogPost);
17+
await blogPostRepository.StoreAsync(blogPost);
1818
toastService.ShowInfo($"Created BlogPost {blogPost.Title}");
1919
}
2020
}

0 commit comments

Comments
 (0)