Skip to content

Commit

Permalink
renamed classes to CamelCases style
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkenHouk committed Jul 25, 2022
1 parent 8f81f37 commit 75849cd
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 43 deletions.
10 changes: 5 additions & 5 deletions Application/Configuration/ApplicationServicesConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public static void AddApplicationServices(this IServiceCollection services)
services.AddScoped<IAnimalPhotoService, AnimalPhotoService>();
services.AddScoped<IFeedbackService, FeedbackService>();

services.AddScoped<IPDfGenerator, PDF_Generator>();
services.AddScoped<ICreateTableForPDF<FinancialStatement>, CreateTableForFinancialStatementPDF>();
services.AddScoped<IGenerateFullPDF<FinancialStatementParameters>, FinancialStatementPDfGenerator>();
services.AddScoped<IPdfGenerator, PdfGenerator>();
services.AddScoped<ICreateTableForPdf<FinancialStatement>, CreateTableForFinancialStatementPdf>();
services.AddScoped<IGenerateFullPdf<FinancialStatementParameters>, FinancialStatementPDfGenerator>();

services.AddScoped<ICreateTableForPDF<Appointment>, CreateTableForAnimalMedCardPDF>();
services.AddScoped<IGenerateFullPDF<AnimalParameters>, AnimalMedCardPDFGenerator>();
services.AddScoped<ICreateTableForPdf<Appointment>, CreateTableForAnimalMedCardPDF>();
services.AddScoped<IGenerateFullPdf<AnimalParameters>, AnimalMedCardPdfGenerator>();

services.AddScoped<IEmailService, EmailService>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,30 @@
using Core.Interfaces.Services.PDF_Service;
using Core.Models;
using Core.Paginator.Parameters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.Services.GeneratePDF.AnimalMedCard_PDF
{
public class AnimalMedCardPDFGenerator : IGenerateFullPDF<AnimalParameters>
public class AnimalMedCardPdfGenerator : IGenerateFullPdf<AnimalParameters>
{
private readonly IAnimalService _animalService;
private readonly ICreateTableForPDF<Appointment> _createTable;
private readonly IPDfGenerator _PDFGenerator;
private readonly ICreateTableForPdf<Appointment> _createTable;
private readonly IPdfGenerator _PDFGenerator;

public AnimalMedCardPDFGenerator(
public AnimalMedCardPdfGenerator(
IAnimalService animalService,
ICreateTableForPDF<Appointment> createTable,
IPDfGenerator pDFGenerator)
ICreateTableForPdf<Appointment> createTable,
IPdfGenerator pDFGenerator)
{
_animalService = animalService;
_createTable = createTable;
_PDFGenerator = pDFGenerator;
}

public async Task<PdfFileModel> GeneratePDF(AnimalParameters parameters)
public async Task<PdfFileModel> GeneratePdf(AnimalParameters parameters)
{
var medCardList = await _animalService.GetAllAppointmentsWithAnimalIdAsync(parameters);
var medCardTable = _createTable.CreateTable(medCardList);
var pdfFileParams = _PDFGenerator.CreatePDF(medCardTable);
var pdfFileParams = _PDFGenerator.CreatePdf(medCardTable);

return pdfFileParams;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Application.Services.GeneratePDF.AnimalMedCard_PDF
{
public class CreateTableForAnimalMedCardPDF : ICreateTableForPDF<Appointment>
public class CreateTableForAnimalMedCardPDF : ICreateTableForPdf<Appointment>
{
public DataTable CreateTable(PagedList<Appointment> listOfAppointments)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Application.Services.GeneratePDF.FinancialStatement_PDF
{
public class CreateTableForFinancialStatementPDF : ICreateTableForPDF<FinancialStatement>
public class CreateTableForFinancialStatementPdf : ICreateTableForPdf<FinancialStatement>
{
public DataTable CreateTable(PagedList<FinancialStatement> listOfFinancialStatement)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@

namespace Application.Services.GeneratePDF.FinancialStatement_PDF
{
public class FinancialStatementPDfGenerator: IGenerateFullPDF<FinancialStatementParameters>
public class FinancialStatementPDfGenerator: IGenerateFullPdf<FinancialStatementParameters>
{
readonly IFinancialService _financialService;
readonly ICreateTableForPDF<FinancialStatement> _createTable;
readonly IPDfGenerator _pDfGenerator;
readonly ICreateTableForPdf<FinancialStatement> _createTable;
readonly IPdfGenerator _pDfGenerator;

public FinancialStatementPDfGenerator(
IFinancialService financialService,
ICreateTableForPDF<FinancialStatement> createTable,
IPDfGenerator pDfGenerator)
ICreateTableForPdf<FinancialStatement> createTable,
IPdfGenerator pDfGenerator)
{
_financialService = financialService;
_createTable = createTable;
_pDfGenerator = pDfGenerator;
}

public async Task<PdfFileModel> GeneratePDF(FinancialStatementParameters parameters)
public async Task<PdfFileModel> GeneratePdf(FinancialStatementParameters parameters)
{
var financialStatementList = await _financialService.GetFinancialStatement(parameters);
var financialStatementTable = _createTable.CreateTable(financialStatementList);
var pdfFileParams = _pDfGenerator.CreatePDF(financialStatementTable);
var pdfFileParams = _pDfGenerator.CreatePdf(financialStatementTable);

return pdfFileParams;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@

namespace Application.Services.GeneratePDF
{
public class PDF_Generator : IPDfGenerator
public class PdfGenerator : IPdfGenerator
{
private readonly IConfiguration _configuration;
private readonly string _fileName;
private readonly string _contentType;

public PDF_Generator(IConfiguration configuration)
public PdfGenerator(IConfiguration configuration)
{
_configuration = configuration;
_fileName = _configuration["Pdf:DefaultFileName"];
_contentType = _configuration["Pdf:ContentType"];
}

public PdfFileModel CreatePDF(DataTable table)
public PdfFileModel CreatePdf(DataTable table)
{
//Create a new PDF document
PdfDocument doc = new PdfDocument();
Expand Down
2 changes: 1 addition & 1 deletion Core/Interfaces/Services/PDF_Service/ICreateTableForPDF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Core.Interfaces.Services.PDF_Service
{
public interface ICreateTableForPDF<TypeOfListElement>
public interface ICreateTableForPdf<TypeOfListElement>
{
DataTable CreateTable(PagedList<TypeOfListElement> list);
}
Expand Down
4 changes: 2 additions & 2 deletions Core/Interfaces/Services/PDF_Service/IGenerateFullPDF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

namespace Core.Interfaces.Services.PDF_Service
{
public interface IGenerateFullPDF<TypeOfParameters>
public interface IGenerateFullPdf<TypeOfParameters>
{
Task<PdfFileModel> GeneratePDF(TypeOfParameters parameters);
Task<PdfFileModel> GeneratePdf(TypeOfParameters parameters);
}
}
4 changes: 2 additions & 2 deletions Core/Interfaces/Services/PDF_Service/IPDfGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

namespace Core.Interfaces.Services.PDF_Service
{
public interface IPDfGenerator
public interface IPdfGenerator
{
PdfFileModel CreatePDF(DataTable table);
PdfFileModel CreatePdf(DataTable table);
}
}
4 changes: 2 additions & 2 deletions Tests/WebApi.Test/Fixtures/AnimalControllerFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public AnimalControllerFixture()
MockAnimalListToListMapper = fixture.Freeze<Mock<IEnumerableViewModelMapper<IEnumerable<Animal>, IEnumerable<AnimalViewModel>>>>();
MockAnimalViewModelMapperUpdater = fixture.Freeze<Mock<IViewModelMapperUpdater<AnimalViewModel, Animal>>>();
MockPagedMedCardMapper = fixture.Freeze<Mock<IViewModelMapper<PagedList<Appointment>, PagedReadViewModel<AnimalMedCardViewModel>>>>();
MockMedCardPdf = fixture.Freeze<Mock<IGenerateFullPDF<AnimalParameters>>>();
MockMedCardPdf = fixture.Freeze<Mock<IGenerateFullPdf<AnimalParameters>>>();

MockAnimalController = new AnimalController(
MockAnimalService.Object,
Expand All @@ -53,7 +53,7 @@ public AnimalControllerFixture()
public Mock<IEnumerableViewModelMapper<IEnumerable<Animal>, IEnumerable<AnimalViewModel>>> MockAnimalListToListMapper { get; }
public Mock<IViewModelMapperUpdater<AnimalViewModel, Animal>> MockAnimalViewModelMapperUpdater { get; }
public Mock<IViewModelMapper<PagedList<Appointment>, PagedReadViewModel<AnimalMedCardViewModel>>> MockPagedMedCardMapper { get; }
public Mock<IGenerateFullPDF<AnimalParameters>> MockMedCardPdf { get; }
public Mock<IGenerateFullPdf<AnimalParameters>> MockMedCardPdf { get; }
public AnimalController MockAnimalController { get; }
public Animal ExpectedAnimal { get; }
public AnimalViewModel ExpectedAnimalViewModel { get; }
Expand Down
6 changes: 3 additions & 3 deletions WebApi/Controllers/AnimalController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public class AnimalController : ControllerBase
private readonly IViewModelMapperUpdater<AnimalViewModel, Animal> _mapperVMtoM;
private readonly IEnumerableViewModelMapper<IEnumerable<Animal>, IEnumerable<AnimalViewModel>> _mapperAnimalListToList;
private readonly IViewModelMapper<PagedList<Appointment>, PagedReadViewModel<AnimalMedCardViewModel>> _pagedMedCardMapper;
private readonly IGenerateFullPDF<AnimalParameters> _generatePDF;
private readonly IGenerateFullPdf<AnimalParameters> _generatePDF;


public AnimalController(
IAnimalService animalService,
IViewModelMapperUpdater<AnimalViewModel, Animal> mapperVMtoM,
IEnumerableViewModelMapper<IEnumerable<Animal>, IEnumerable<AnimalViewModel>> mapperAnimalListToList,
IViewModelMapper<PagedList<Appointment>, PagedReadViewModel<AnimalMedCardViewModel>> pagedMedCardMapper,
IGenerateFullPDF<AnimalParameters> generatePDF)
IGenerateFullPdf<AnimalParameters> generatePDF)
{
_animalService = animalService;
_mapperVMtoM = mapperVMtoM;
Expand Down Expand Up @@ -55,7 +55,7 @@ public async Task<PagedReadViewModel<AnimalMedCardViewModel>> GetMedCardAsync([F
[HttpGet("generatePDF")]
public async Task<FileStreamResult> GeneratePDF([FromQuery] AnimalParameters animalParameters)
{
var pdfFileParams = await _generatePDF.GeneratePDF(animalParameters);
var pdfFileParams = await _generatePDF.GeneratePdf(animalParameters);
var result = this.File(pdfFileParams);
return result;
}
Expand Down
6 changes: 3 additions & 3 deletions WebApi/Controllers/FinancialController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class FinancialController : ControllerBase
private readonly IViewModelMapper<PagedList<Salary>, PagedReadViewModel<SalaryViewModel>> _readSalaryList;
private readonly IViewModelMapper<IEnumerable<User>, IEnumerable<EmployeeViewModel>> _readEmployeesList;
private readonly IViewModelMapper<PagedList<FinancialStatement>, PagedReadViewModel<FinancialStatementForMonthViewModel>> _finStatViewModel;
private readonly IGenerateFullPDF<FinancialStatementParameters> _generatePDF;
private readonly IGenerateFullPdf<FinancialStatementParameters> _generatePDF;

public FinancialController(
IFinancialService financialService,
Expand All @@ -35,7 +35,7 @@ public FinancialController(
IViewModelMapper<PagedList<Salary>, PagedReadViewModel<SalaryViewModel>> readSalaryList,
IViewModelMapper<IEnumerable<User>, IEnumerable<EmployeeViewModel>> readEmployeesList,
IViewModelMapper<PagedList<FinancialStatement>, PagedReadViewModel<FinancialStatementForMonthViewModel>> finStatViewModel,
IGenerateFullPDF<FinancialStatementParameters> generatePDF
IGenerateFullPdf<FinancialStatementParameters> generatePDF
)
{
_financialService = financialService;
Expand All @@ -51,7 +51,7 @@ IGenerateFullPDF<FinancialStatementParameters> generatePDF
[HttpGet("generatePDF")]
public async Task<FileStreamResult> GeneratePDF([FromQuery] FinancialStatementParameters parameters)
{
var pdfFileParams = await _generatePDF.GeneratePDF(parameters);
var pdfFileParams = await _generatePDF.GeneratePdf(parameters);
var result = this.File(pdfFileParams);
return result;
}
Expand Down

0 comments on commit 75849cd

Please sign in to comment.