Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

namespace FreelancerBlog.Core.Queries.Data.Articles
{
public class GetAriclesQuery : IRequest<IQueryable<Article>>{ }
public class GetArticlesQuery : IRequest<IQueryable<Article>>{ }
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace FreelancerBlog.Data.Queries.Articles
{
public class GetAriclesQueryHandler : RequestHandler<GetAriclesQuery, IQueryable<Article>>
public class GetAriclesQueryHandler : RequestHandler<GetArticlesQuery, IQueryable<Article>>
{
private FreelancerBlogContext _context;

Expand All @@ -20,7 +20,7 @@ public GetAriclesQueryHandler(FreelancerBlogContext context)
_context = context;
}

protected override IQueryable<Article> Handle(GetAriclesQuery message)
protected override IQueryable<Article> Handle(GetArticlesQuery message)
{
return _context.Articles.Include(a => a.ApplicationUser).Include(a => a.ArticleRatings).Include(a => a.ArticleComments);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="GenFu" Version="1.6.0" />
<PackageReference Include="Moq" Version="4.14.5" />
<PackageReference Include="FluentAssertions" Version="5.8.0" />
<PackageReference Include="GenFu" Version="1.5.6" />
<PackageReference Include="Moq" Version="4.12.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MailKit" Version="2.8.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.7" />
<PackageReference Include="MailKit" Version="2.3.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.2.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public async Task GetArticleTableData_Should_ReturnTheCorrectType()
{
var articles = new List<Article> { new Article(), new Article(), new Article() }.AsQueryable();

A.CallTo(() => _mediator.Send(A<GetAriclesQuery>._, A<CancellationToken>._)).Returns(articles);
A.CallTo(() => _mediator.Send(A<GetArticlesQuery>._, A<CancellationToken>._)).Returns(articles);

var result = await _sut.GetArticleTableData(new DataTablesParam());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task Index_Always_PassesTheCorrectArticlesToMapMethod()
{
var articles = new[] { new Article { ArticleId = 1 } }.AsQueryable();

A.CallTo(() => _mediatorFake.Send(A<GetAriclesQuery>.Ignored, A<CancellationToken>.Ignored)).Returns(articles);
A.CallTo(() => _mediatorFake.Send(A<GetArticlesQuery>.Ignored, A<CancellationToken>.Ignored)).Returns(articles);

await _sut.Index();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ArticleController(IFileManager fileManager, IMapper mapper, IMediator med
[HttpGet]
public async Task<DataTablesResult<ArticleViewModel>> GetArticleTableData(DataTablesParam dataTableParam)
{
var articles = await _mediator.Send(new GetAriclesQuery());
var articles = await _mediator.Send(new GetArticlesQuery());

var articleViewModels = articles.Select(a => new ArticleViewModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ArticleController(IMapper mapper, IMediator mediator)
[HttpGet]
public async Task<IActionResult> Index()
{
var articles = await _mediator.Send(new GetAriclesQuery());
var articles = await _mediator.Send(new GetArticlesQuery());

var articlesViewModel = _mapper.Map<IQueryable<Article>, List<ArticleViewModel>>(articles);

Expand Down
14 changes: 9 additions & 5 deletions FreelancerBlog/FreelancerBlog/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void ConfigureServices(IServiceCollection services)

services.AddMvcJQueryDataTables();

services.AddAutoMapper(typeof(Startup));
services.AddAutoMapper();

services.AddMemoryCache();

Expand All @@ -114,7 +114,8 @@ public void ConfigureServices(IServiceCollection services)
{
o.LoginPath = new PathString("/Account/Login/");
o.AccessDeniedPath = new PathString("/Account/Forbidden/");
}).AddFacebook(o =>
})
.AddFacebook(o =>
{
o.AppId = Configuration["OAuth:Facebook:AppId"];
o.AppSecret = Configuration["OAuth:Facebook:AppSecret"];
Expand All @@ -123,7 +124,8 @@ public void ConfigureServices(IServiceCollection services)
//Scope.Add("email"),
o.BackchannelHttpHandler = new FacebookBackChannelHandler();
o.UserInformationEndpoint = "https://graph.facebook.com/v2.4/me?fields=id,name,email,first_name,last_name,location";
}).AddGoogle(o =>
})
.AddGoogle(o =>
{
o.ClientId = Configuration["OAuth:Google:ClientId"];
o.ClientSecret = Configuration["OAuth:Google:ClientSecret"];
Expand All @@ -137,12 +139,14 @@ public void ConfigureServices(IServiceCollection services)
return Task.FromResult(0);
}
};
}).AddMicrosoftAccount(MicrosoftAccountDefaults.AuthenticationScheme, "FreelancerBlog Microsoft OAuth", o =>
})
.AddMicrosoftAccount(MicrosoftAccountDefaults.AuthenticationScheme, "FreelancerBlog Microsoft OAuth", o =>
{
o.ClientId = Configuration["OAuth:Microsoft:ClientId"];
o.ClientSecret = Configuration["OAuth:Microsoft:ClientSecret"];
//Scope.Add("wl.emails, wl.basic"),
}).AddTwitter(TwitterDefaults.AuthenticationScheme, "FreelancerBlog Twitter Auth", o =>
})
.AddTwitter(TwitterDefaults.AuthenticationScheme, "FreelancerBlog Twitter Auth", o =>
{
o.ConsumerKey = Configuration["OAuth:Twitter:ConsumerKey"];
o.ConsumerSecret = Configuration["OAuth:Twitter:ConsumerSecret"];
Expand Down