Skip to content

Commit

Permalink
Updating .editorconfig and enforcing formatting (#105)
Browse files Browse the repository at this point in the history
* Updated .editorconfig and ran dotnet format

* Fixed using statement order

* Enforce formatting in CI build

* Update CI builds to use .NET SDK 6.0.x

* Upgrade test project to .NET 6

* Updated MSTest packages to fix tests
  • Loading branch information
mattherman authored Sep 26, 2022
1 parent 625718d commit a2cfcfd
Show file tree
Hide file tree
Showing 115 changed files with 5,951 additions and 5,882 deletions.
77 changes: 72 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,76 @@
# http://editorconfig.org

# This file is the top-most EditorConfig file
root = true

# All Files
[*]
charset = utf-8
end_of_line = crlf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.cs]
dotnet_diagnostic.CA2007.severity = none

[*.{yml,tf}]
indent_style = space
indent_size = 4
indent_size = 2

[*.csproj]
indent_style = space
indent_size = 2

[{Dockerfile,task.json,*.sh}]
end_of_line = lf

[*.cs]
# C# Formatting Rules
# See: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0055

dotnet_sort_system_directives_first = true

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_space_after_keywords_in_control_flow_statements = true

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_after_cast = false

csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false

csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false

csharp_space_after_comma = true
csharp_space_before_comma = false

csharp_space_after_dot = false
csharp_space_before_dot = false

csharp_space_after_semicolon_in_for_statement = true

csharp_space_around_declaration_statements = false

csharp_space_before_open_square_brackets = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_square_brackets = false

csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true

csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false
csharp_indent_switch_labels = true
csharp_indent_block_contents = true
csharp_indent_braces = false

56 changes: 29 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
name: CI

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.402
- name: Build
run: dotnet build --configuration Release
- name: Start Mountebank
run: |
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
npm install -g mountebank
mb --mock --allowInjection --debug &
- name: Test
run: dotnet test --configuration Release --no-build
name: CI

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Verify Formatting
run: dotnet format --verify-no-changes
- name: Build
run: dotnet build --configuration Release
- name: Start Mountebank
run: |
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
npm install -g mountebank
mb --mock --allowInjection --debug &
- name: Test
run: dotnet test --configuration Release --no-build
44 changes: 22 additions & 22 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: NuGet

on: [create]

jobs:
package:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.402
- name: Create Package
run: dotnet pack ./MbDotNet/MbDotNet.csproj -c Release -o packages
- name: Archive production artifacts
uses: actions/upload-artifact@v1
with:
name: packages
path: MbDotNet/packages
name: NuGet

on: [create]

jobs:
package:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: Create Package
run: dotnet pack ./MbDotNet/MbDotNet.csproj -c Release -o packages
- name: Archive production artifacts
uses: actions/upload-artifact@v1
with:
name: packages
path: MbDotNet/packages
32 changes: 16 additions & 16 deletions MbDotNet.Tests/Acceptance/AcceptanceTestBase.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace MbDotNet.Tests.Acceptance
{
public class AcceptanceTestBase
{
protected readonly MountebankClient _client;

public AcceptanceTestBase()
{
_client = new MountebankClient();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;

namespace MbDotNet.Tests.Acceptance
{
public class AcceptanceTestBase
{
protected readonly MountebankClient _client;

public AcceptanceTestBase()
{
_client = new MountebankClient();
}
}
}
50 changes: 25 additions & 25 deletions MbDotNet.Tests/Acceptance/ConfigTests.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace MbDotNet.Tests.Acceptance
{
[TestClass, TestCategory("Acceptance")]
public class ConfigTests : AcceptanceTestBase
{
[TestInitialize]
public async Task TestInitialize()
{
await _client.DeleteAllImpostersAsync();
}

[TestMethod]
public async Task GetConfig()
{
var result = await _client.GetConfigAsync();
Assert.IsNotNull(result);
Assert.IsNotNull(result.Version);
Assert.IsTrue(result.Process.Count > 0);
Assert.IsTrue(result.Options.Count > 0);
}
}
}
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace MbDotNet.Tests.Acceptance
{
[TestClass, TestCategory("Acceptance")]
public class ConfigTests : AcceptanceTestBase
{
[TestInitialize]
public async Task TestInitialize()
{
await _client.DeleteAllImpostersAsync();
}

[TestMethod]
public async Task GetConfig()
{
var result = await _client.GetConfigAsync();
Assert.IsNotNull(result);
Assert.IsNotNull(result.Version);
Assert.IsTrue(result.Process.Count > 0);
Assert.IsTrue(result.Options.Count > 0);
}
}
}
Loading

0 comments on commit a2cfcfd

Please sign in to comment.