Skip to content
Permalink
Browse files

Complete restructure of .NET application

  • Loading branch information...
Duco
Duco committed Jun 2, 2019
2 parents 5d6aaf1 + b3f984c commit 908aa04368c8b7ae49cfaf76742897f2d0148f06
Showing 313 changed files with 7,240 additions and 5,183 deletions.

Large diffs are not rendered by default.

@@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"start": "vue-cli-service serve",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
@@ -11,6 +11,12 @@ Param(
$binDir = Join-Path $srcFolder "HttPlaceholder\bin\release\netcoreapp2.2\linux-x64\publish"
$docsFolder = Join-Path $srcFolder "..\docs"

# Patching main .csproj file
[xml]$csproj = Get-Content $mainProjectFile
$propertyGroupNode = $csproj.SelectSingleNode("/Project/PropertyGroup[1]")
$propertyGroupNode.PackAsTool = "false"
$csproj.Save($mainProjectFile)

# Create Linux package
Write-Host "Packing up for Linux" -ForegroundColor Green
& dotnet publish $mainProjectFile --configuration=release --runtime=linux-x64
@@ -11,6 +11,12 @@ Param(
$binDir = Join-Path $srcFolder "HttPlaceholder\bin\release\netcoreapp2.2\osx-x64\publish"
$docsFolder = Join-Path $srcFolder "..\docs"

# Patching main .csproj file
[xml]$csproj = Get-Content $mainProjectFile
$propertyGroupNode = $csproj.SelectSingleNode("/Project/PropertyGroup[1]")
$propertyGroupNode.PackAsTool = "false"
$csproj.Save($mainProjectFile)

# Create OS X package
Write-Host "Packing up for OS X" -ForegroundColor Green
& dotnet publish $mainProjectFile --configuration=release --runtime=osx-x64
@@ -12,8 +12,10 @@ foreach ($csprojFile in $csprojFiles) {
Write-Host "Parsing .csproj file $($csprojFile.FullName)"
[xml]$csprojContents = Get-Content $csprojFile.FullName
$propertyGroupNode = $csprojContents.SelectSingleNode("/Project/PropertyGroup[1]")
$propertyGroupNode.Version = $env:versionString
$propertyGroupNode.AssemblyVersion = $env:versionString
$propertyGroupNode.FileVersion = $env:versionString
$csprojContents.Save($csprojFile.FullName)
if ($null -ne $propertyGroupNode.Version) {
$propertyGroupNode.Version = $env:versionString
$propertyGroupNode.AssemblyVersion = $env:versionString
$propertyGroupNode.FileVersion = $env:versionString
$csprojContents.Save($csprojFile.FullName)
}
}
@@ -37,12 +37,6 @@ if ($runUnitTests) {
}
}

# Generating swagger.json file
Write-Host "Generating swagger.json file"
$swaggerGenBinFile = Join-Path -Path $srcFolder "HttPlaceholder.SwaggerGenerator\bin\Debug\netcoreapp2.2\HttPlaceholder.SwaggerGenerator.dll"
& dotnet $swaggerGenBinFile
Assert-Cmd-Ok

# Release package build
Write-Host "Building a release package"

@@ -1,6 +1,154 @@
###############################
# Core EditorConfig Options #
###############################

root = true

# All files
[*]
end_of_line = crlf
end_of_line = crlf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

# Code files
[*.{cs, csx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom

###############################
# .NET Coding Conventions #
###############################

[*.cs]
indent_style = space
indent_size = 4
# Organize usings
dotnet_sort_system_directives_first = true

# this. preferences
dotnet_style_qualification_for_field = false : suggestion
dotnet_style_qualification_for_property = false : suggestion
dotnet_style_qualification_for_method = false : suggestion
dotnet_style_qualification_for_event = false : suggestion

# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion
dotnet_style_predefined_type_for_member_access = true : suggestion

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity : suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity : suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity : suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary : suggestion

# Modifier preferences
dotnet_style_require_accessibility_modifiers = always : suggestion
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 : suggestion
dotnet_style_prefer_inferred_tuple_names = true : suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true : suggestion
dotnet_style_prefer_auto_properties = true : suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true : suggestion
dotnet_style_prefer_conditional_expression_over_return = true : suggestion

###############################
# 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

###############################
# C# Code Style Rules #
###############################

# var preferences
csharp_style_var_for_built_in_types = true : suggestion
csharp_style_var_when_type_is_apparent = true : suggestion
csharp_style_var_elsewhere = true : suggestion

# Expression-bodied members
csharp_style_expression_bodied_methods = true : suggestion
csharp_style_expression_bodied_constructors = false : warning
csharp_style_expression_bodied_operators = false : suggestion
csharp_style_expression_bodied_properties = true : suggestion
csharp_style_expression_bodied_indexers = true : suggestion
csharp_style_expression_bodied_accessors = true : suggestion

# 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 : suggestion
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

# private variable underscore
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 = _

###############################
# 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_between_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
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\HttPlaceholder.Application\HttPlaceholder.Application.csproj" />
<ProjectReference Include="..\HttPlaceholder.TestUtilities\HttPlaceholder.TestUtilities.csproj" />
</ItemGroup>

</Project>
@@ -1,24 +1,22 @@
using System.Collections.Generic;
using Ducode.Essentials.Mvc.Interfaces;
using HttPlaceholder.BusinessLogic.Implementations.ConditionCheckers;
using HttPlaceholder.Models;
using HttPlaceholder.Models.Enums;
using HttPlaceholder.Services;
using HttPlaceholder.Application.Implementations.ConditionCheckers;
using HttPlaceholder.Domain;
using HttPlaceholder.Domain.Enums;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace HttPlaceholder.BusinessLogic.Tests.Implementations.ConditionCheckers
namespace HttPlaceholder.Application.Tests.StubExecution.ConditionChecking
{
[TestClass]
public class BasicAuthenticationConditionCheckerFacts
{
private Mock<IHttpContextService> _httpContextServiceMock;
private Mock<IHttpContextService> _httpContextServiceMock = new Mock<IHttpContextService>();
private BasicAuthenticationConditionChecker _checker;

[TestInitialize]
public void Initialize()
{
_httpContextServiceMock = new Mock<IHttpContextService>();
_checker = new BasicAuthenticationConditionChecker(
_httpContextServiceMock.Object);
}
@@ -132,4 +130,4 @@ public void BasicAuthenticationConditionChecker_Validate_HappyFlow()
Assert.AreEqual(ConditionValidationType.Valid, result.ConditionValidation);
}
}
}
}
@@ -1,23 +1,21 @@
using Ducode.Essentials.Mvc.Interfaces;
using HttPlaceholder.BusinessLogic.Implementations.ConditionCheckers;
using HttPlaceholder.Models;
using HttPlaceholder.Models.Enums;
using HttPlaceholder.Services;
using HttPlaceholder.Application.Implementations.ConditionCheckers;
using HttPlaceholder.Domain;
using HttPlaceholder.Domain.Enums;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace HttPlaceholder.BusinessLogic.Tests.Implementations.ConditionCheckers
namespace HttPlaceholder.Application.Tests.StubExecution.ConditionChecking
{
[TestClass]
public class BodyConditionCheckerFacts
{
private Mock<IHttpContextService> _httpContextServiceMock;
private Mock<IHttpContextService> _httpContextServiceMock = new Mock<IHttpContextService>();
private BodyConditionChecker _checker;

[TestInitialize]
public void Initialize()
{
_httpContextServiceMock = new Mock<IHttpContextService>();
_checker = new BodyConditionChecker(
_httpContextServiceMock.Object);
}
@@ -143,4 +141,4 @@ public void BodyConditionChecker_Validate_StubsFound_HappyFlow_Regex()
Assert.AreEqual(ConditionValidationType.Valid, result.ConditionValidation);
}
}
}
}
@@ -1,34 +1,29 @@
using Ducode.Essentials.Mvc.Interfaces;
using HttPlaceholder.BusinessLogic.Implementations.ConditionCheckers;
using HttPlaceholder.Models;
using HttPlaceholder.Models.Enums;
using HttPlaceholder.Services;
using HttPlaceholder.Application.Implementations.ConditionCheckers;
using HttPlaceholder.Domain;
using HttPlaceholder.Domain.Enums;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace HttPlaceholder.BusinessLogic.Tests.Implementations.ConditionCheckers
namespace HttPlaceholder.Application.Tests.StubExecution.ConditionChecking
{
[TestClass]
public class ClientIpConditionCheckerFacts
{
private Mock<IClientIpResolver> _clientIpResolverMock;
private Mock<IHttpContextService> _httpContextServiceMock;
private Mock<IClientIpResolver> _clientIpResolverMock = new Mock<IClientIpResolver>();
private ClientIpConditionChecker _checker;

[TestInitialize]
public void Initialize()
{
_clientIpResolverMock = new Mock<IClientIpResolver>();
_httpContextServiceMock = new Mock<IHttpContextService>();
_checker = new ClientIpConditionChecker(
_clientIpResolverMock.Object,
_httpContextServiceMock.Object);
_clientIpResolverMock.Object);
}

[TestCleanup]
public void Cleanup()
{
_httpContextServiceMock.VerifyAll();
_clientIpResolverMock.VerifyAll();
}

[TestMethod]
@@ -136,4 +131,4 @@ public void ClientIpConditionChecker_Validate_IpRange_InRange_ShouldReturnValid(
Assert.AreEqual(ConditionValidationType.Valid, result.ConditionValidation);
}
}
}
}

0 comments on commit 908aa04

Please sign in to comment.
You can’t perform that action at this time.