Skip to content

Commit

Permalink
Totally reimagined template
Browse files Browse the repository at this point in the history
  • Loading branch information
Haik committed Mar 17, 2024
1 parent 48dccae commit f6fde58
Show file tree
Hide file tree
Showing 176 changed files with 3,501 additions and 2,240 deletions.
143 changes: 143 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
###############################
# PandaTech Editor Config #
###############################
root = true

# All files
[*]
indent_style = space
indent_size = 3

# Code files
[*.{cs,csx,vb,vbx}]
insert_final_newline = true

###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true
# this. preferences
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
tab_width = 2
dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
dotnet_naming_rule.private_members_with_underscore.severity = suggestion
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_style.prefix_underscore.capitalization = camel_case
dotnet_naming_style.prefix_underscore.required_prefix = _
dotnet_style_operator_placement_when_wrapping = beginning_of_line
end_of_line = crlf

###############################
# C# Coding Conventions #
###############################
[*.cs]
# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:silent
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
# Namespaces


###############################
# C# Formatting Rules #
###############################
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
csharp_using_directive_placement = outside_namespace:suggestion
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
# Error preferences
dotnet_diagnostic.CS8602.severity = error #possible dereference of a null reference
dotnet_diagnostic.CS8603.severity = error #possible null reference return
dotnet_diagnostic.CS1717.severity = error #variable is assigned to itself
dotnet_diagnostic.CS1718.severity = error #comparison made to same variable
dotnet_diagnostic.CS0659.severity = error #overriding object.Equals but not overriding object.GetHashCode
dotnet_diagnostic.CS0251.severity = error #Indexing an array with a negative index (array indices always start at zero)
11 changes: 11 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
</PropertyGroup>
</Project>
63 changes: 63 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<Project>
<ItemGroup>
<PackageVersion Include="AspNetCore.HealthChecks.Elasticsearch" Version="8.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.NpgSql" Version="8.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.Rabbitmq" Version="8.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.Redis" Version="8.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.UI.Client" Version="8.0.0" />
<PackageVersion Include="AutoMapper" Version="13.0.1" />
<PackageVersion Include="Bogus" Version="35.5.0" />
<PackageVersion Include="Carter" Version="8.0.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="CsvHelper" Version="31.0.2" />
<PackageVersion Include="EFCore.NamingConventions" Version="8.0.3" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="FluentDateTime" Version="3.0.0" />
<PackageVersion Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageVersion Include="Hangfire.AspNetCore" Version="1.8.11" />
<PackageVersion Include="Hangfire.Core" Version="1.8.11" />
<PackageVersion Include="Hangfire.Dashboard.Basic.Authentication" Version="7.0.1" />
<PackageVersion Include="Hangfire.EntityFrameworkCore" Version="0.6.0" />
<PackageVersion Include="Hangfire.PostgreSql" Version="1.20.8" />
<PackageVersion Include="MediatR" Version="12.2.0" />
<PackageVersion Include="MediatR.Contracts" Version="2.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.3" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.3" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageVersion Include="Microsoft.FeatureManagement.AspNetCore" Version="3.2.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageVersion Include="PandaTech.BaseConverter" Version="3.0.1" />
<PackageVersion Include="PandaTech.IEnumerableFilters" Version="4.0.19" />
<PackageVersion Include="Pandatech.Communicator" Version="1.0.2" />
<PackageVersion Include="Pandatech.Crypto" Version="2.3.1" />
<PackageVersion Include="Pandatech.PandaVaultClient" Version="3.0.6" />
<PackageVersion Include="Pandatech.RegexBox" Version="1.2.4" />
<PackageVersion Include="Pandatech.ResponseCrafter" Version="1.0.4" />
<PackageVersion Include="Respawn" Version="6.2.1" />
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageVersion Include="Serilog.Enrichers.Environment" Version="2.3.0" />
<PackageVersion Include="Serilog.Sinks.Elasticsearch" Version="10.0.0" />
<PackageVersion Include="SharpGrip.FluentValidation.AutoValidation.Mvc" Version="1.4.0" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.21.0.86780">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="StackExchange.Redis" Version="2.7.33" />
<PackageVersion Include="StackExchange.Redis.Extensions.AspNetCore" Version="10.2.0" />
<PackageVersion Include="StackExchange.Redis.Extensions.Newtonsoft" Version="10.2.0" />
<PackageVersion Include="StackExchange.Redis.Extensions.Protobuf" Version="10.2.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="Testcontainers.PostgreSql" Version="3.7.0" />
<PackageVersion Include="protobuf-net.Core" Version="3.2.30" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
COPY ["./publish/", "./"]
ENTRYPOINT ["dotnet", "PandaWebApi.dll"]
ENTRYPOINT ["dotnet", "Pandatech.VerticalSlices.dll"]
4 changes: 4 additions & 0 deletions PandaVerticalSlices.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=appsettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=respawner/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=superadmin/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
22 changes: 0 additions & 22 deletions PandaWebApi.sln

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Npgsql;
using PandaWebApi;
using Pandatech.VerticalSlices.Infrastructure.Contexts;
using Respawn;
using Testcontainers.PostgreSql;
using PandaWebApi.Contexts;

namespace WebApiPostgresTests.Configurations;
namespace Pandatech.VerticalSlices.Tests.Configurations;

public class ApiFactory : WebApplicationFactory<Program>, IAsyncLifetime
{
Expand Down Expand Up @@ -58,7 +57,7 @@ private async Task InitializeRespawner()
_respawner = await Respawner.CreateAsync(_dbConnection, new RespawnerOptions
{
DbAdapter = DbAdapter.Postgres,
SchemasToInclude = new[] { "public" }
SchemasToInclude = ["public"]
});
}

Expand Down Expand Up @@ -92,4 +91,4 @@ private void SetEnvironments()
Environment.SetEnvironmentVariable("CORS_ALLOWED_ORIGINS", "http://localhost:3000");
Environment.SetEnvironmentVariable("USER_MANAGEMENT_ADDRESS", "http://localhost:5000");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace WebApiPostgresTests.Configurations;
namespace Pandatech.VerticalSlices.Tests.Configurations;

[CollectionDefinition("Shared Postgres")]
public class SharedPostgresTestCollection : ICollectionFixture<ApiFactory>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace WebApiPostgresTests.Helpers;
namespace Pandatech.VerticalSlices.Tests.Helpers;

public class HttpHelper
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="Respawn" />
<PackageReference Include="SonarAnalyzer.CSharp">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Testcontainers.PostgreSql" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\src\Pandatech.VerticalSlices\Pandatech.VerticalSlices.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using WebApiPostgresTests.Configurations;
using Pandatech.VerticalSlices.Tests.Configurations;

namespace WebApiPostgresTests.Tests.IntegrationTests;
namespace Pandatech.VerticalSlices.Tests.Tests.IntegrationTests;

[Collection("Shared Postgres")]
public class IntegrationTest:IAsyncLifetime
Expand Down
6 changes: 6 additions & 0 deletions Pandatech.VerticalSlices.Tests/Tests/UnitTests/UnitTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Pandatech.VerticalSlices.Tests.Tests.UnitTests;

public class UnitTest
{

}
2 changes: 2 additions & 0 deletions Pandatech.VerticalSlices.Tests/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
global using Xunit;
global using FluentAssertions;
Loading

0 comments on commit f6fde58

Please sign in to comment.