Skip to content

Commit d8a79e4

Browse files
egilduracellkoSiphonophora
authored
BETA 5 (#41)
* Fixed spelling mistake in comment * Reordered parameters to top of TestRenderer * Add support for asynchronous Razor tests (#27) * Add support for asyncrhonous Razor tests * Rename Fixture.AsyncTest to TestAsync * Update description of Fixture Co-Authored-By: Egil Hansen <[email protected]> * Dotnetconf samples (#33) * Basic example tests * Add missing MarkupMatches overload * Added docs to MockHttp extensions * dotnet conf samples * Added unit tests of CompareTo, Generic and Collection assert extensions. * Added tests for general events and touch events dispatch extensions * Added tests for anglesharp extensions, JsRuntimeInvocation and ComponentParameter * Removed assert helpers that conflict with Shoudly * Tests of JsRuntimeAsserts * Reorganized test library * Suppressing warnings in sample * Changed ITestContext to have a CreateNodes method instead of HtmlParser property * Removed empty test * Added missing code documentation * Moved MockJsRuntime to its own namespace * Pulled sample from main solution into own solution * Update main.yml * Change GetNodes and GetMarkup to Nodes and Markup properties in IRenderedFragment (#34) * Add SetupVoid and SetVoidResult capabilities to JsRuntime mock (#35) * Moved MockJsRuntime to its own namespace * Add SetupVoid() and SetVoidResult() to PlannedInvocation and Mock * Updates to template and sample * Add default JsRuntime (#32) * Add default JsRuntime * Update src/Mocking/JSInterop/DefaultJsRuntime.cs Co-Authored-By: Egil Hansen <[email protected]> * Response to review. Add custom exception and code cleanup * Remove unneded method * Update src/Mocking/JSInterop/MissingMockJsRuntimeException.cs Co-Authored-By: Egil Hansen <[email protected]> * Update src/Mocking/JSInterop/MissingMockJsRuntimeException.cs Co-Authored-By: Egil Hansen <[email protected]> * Update src/Mocking/JSInterop/MissingMockJsRuntimeException.cs Co-Authored-By: Egil Hansen <[email protected]> * Update src/Mocking/JSInterop/MissingMockJsRuntimeException.cs Co-Authored-By: Egil Hansen <[email protected]> * Update src/Mocking/JSInterop/MissingMockJsRuntimeException.cs Co-Authored-By: Egil Hansen <[email protected]> * Update src/Mocking/JSInterop/MissingMockJsRuntimeException.cs Co-Authored-By: Egil Hansen <[email protected]> Co-authored-by: Egil Hansen <[email protected]> * Add .vscode to gitignore * TestServiceProvider now explictly implements IServiceCOlelction (#40) * TestServiceProvider now explictly implements IServiceCOlelction * Tweaks to namespaces * Added async setup method to snapshot test * Added test of SnapshotTests use of setup methods * Update to readme * Removed duplicated MarkupMatches method * Removed PR trigger Co-authored-by: Rastislav Novotný <[email protected]> Co-authored-by: Michael J Conrad <[email protected]>
1 parent 3df4dec commit d8a79e4

File tree

94 files changed

+2067
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2067
-519
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
name: CI
33

4-
on: [push, pull_request]
4+
on: push
55

66
env:
77
VERSION: 1337.0.0
@@ -28,8 +28,10 @@ jobs:
2828
dotnet-version: '3.1.100'
2929
- name: Building and verifying library
3030
run: |
31-
dotnet build -c Release /nowarn:CS1591
31+
dotnet build -c Release
3232
dotnet test -c Release /nowarn:CS1591
33+
dotnet build sample -c Release
34+
dotnet test sample -c Release
3335
- name: Creating library package
3436
run: dotnet pack src/ -c Release -o ${GITHUB_WORKSPACE} -p:version=$VERSION /nowarn:CS1591
3537
- name: Buidling template package

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ bld/
2626

2727
# Visual Studio 2015/2017 cache/options directory
2828
.vs/
29+
.vscode/
2930
# Uncomment if you have tasks that create the project's static files in wwwroot
3031
#wwwroot/
3132

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@ This library's goal is to make it easy to write _comprehensive, stable unit test
2222
- [Mocking JsRuntime](https://github.com/egil/razor-components-testing-library/wiki/Mocking-JsRuntime)
2323
- [References](https://github.com/egil/razor-components-testing-library/wiki/References)
2424
- [Contribute](https://github.com/egil/razor-components-testing-library/wiki/Contribute)
25+
26+
## Contributors
27+
28+
Shout outs and a big thank you to the contributors to this library. Here they are, in alphabetically:
29+
30+
- [Michael J Conrad (@Siphonophora)](https://github.com/Siphonophora)
31+
- [Rastislav Novotný (@duracellko)](https://github.com/duracellko)

Razor.Components.Testing.Library.sln

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Egil.RazorComponents.Testin
1919
EndProject
2020
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Egil.RazorComponents.Testing.Library.Tests", "tests\Egil.RazorComponents.Testing.Library.Tests.csproj", "{04E0142A-33CC-4E30-B903-F1370D94AD8C}"
2121
EndProject
22-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{26D90CB9-AF66-4F42-A16E-39D2CF69C8FB}"
23-
EndProject
24-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Egil.RazorComponents.Testing.Library.SampleApp", "sample\src\Egil.RazorComponents.Testing.Library.SampleApp.csproj", "{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE}"
25-
EndProject
26-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Egil.RazorComponents.Testing.Library.SampleApp.Tests", "sample\tests\Egil.RazorComponents.Testing.Library.SampleApp.Tests.csproj", "{A7B05744-AA61-4F8E-8173-5DE812A4A745}"
27-
EndProject
28-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Razor.Components.Testing.Library.Template", "template\Razor.Components.Testing.Library.Template.csproj", "{FB46378D-BFB8-4C72-9CA3-0407D4665218}"
22+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Egil.Razor.Components.Testing.Library.Template", "template\Egil.Razor.Components.Testing.Library.Template.csproj", "{FB46378D-BFB8-4C72-9CA3-0407D4665218}"
2923
EndProject
3024
Global
3125
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -41,14 +35,6 @@ Global
4135
{04E0142A-33CC-4E30-B903-F1370D94AD8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
4236
{04E0142A-33CC-4E30-B903-F1370D94AD8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
4337
{04E0142A-33CC-4E30-B903-F1370D94AD8C}.Release|Any CPU.Build.0 = Release|Any CPU
44-
{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45-
{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
46-
{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
47-
{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE}.Release|Any CPU.Build.0 = Release|Any CPU
48-
{A7B05744-AA61-4F8E-8173-5DE812A4A745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49-
{A7B05744-AA61-4F8E-8173-5DE812A4A745}.Debug|Any CPU.Build.0 = Debug|Any CPU
50-
{A7B05744-AA61-4F8E-8173-5DE812A4A745}.Release|Any CPU.ActiveCfg = Release|Any CPU
51-
{A7B05744-AA61-4F8E-8173-5DE812A4A745}.Release|Any CPU.Build.0 = Release|Any CPU
5238
{FB46378D-BFB8-4C72-9CA3-0407D4665218}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5339
{FB46378D-BFB8-4C72-9CA3-0407D4665218}.Debug|Any CPU.Build.0 = Debug|Any CPU
5440
{FB46378D-BFB8-4C72-9CA3-0407D4665218}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -60,8 +46,6 @@ Global
6046
GlobalSection(NestedProjects) = preSolution
6147
{AA96790B-67C9-4141-ACDB-037C8DC092EC} = {E006E9A4-F554-46DF-838F-812956521F64}
6248
{04E0142A-33CC-4E30-B903-F1370D94AD8C} = {C929375E-BD70-4B78-88C1-BDD1623C3365}
63-
{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE} = {26D90CB9-AF66-4F42-A16E-39D2CF69C8FB}
64-
{A7B05744-AA61-4F8E-8173-5DE812A4A745} = {26D90CB9-AF66-4F42-A16E-39D2CF69C8FB}
6549
{FB46378D-BFB8-4C72-9CA3-0407D4665218} = {E006E9A4-F554-46DF-838F-812956521F64}
6650
EndGlobalSection
6751
GlobalSection(ExtensibilityGlobals) = postSolution

sample/SampleApp.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29613.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp", "src\SampleApp.csproj", "{0C4F7AE0-EA8A-4ECC-9003-1CEE4412BBA7}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp.Tests", "tests\SampleApp.Tests.csproj", "{04F6D258-F69C-4BB5-87C5-3813C3CE33D8}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{0C4F7AE0-EA8A-4ECC-9003-1CEE4412BBA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{0C4F7AE0-EA8A-4ECC-9003-1CEE4412BBA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{0C4F7AE0-EA8A-4ECC-9003-1CEE4412BBA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{0C4F7AE0-EA8A-4ECC-9003-1CEE4412BBA7}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{04F6D258-F69C-4BB5-87C5-3813C3CE33D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{04F6D258-F69C-4BB5-87C5-3813C3CE33D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{04F6D258-F69C-4BB5-87C5-3813C3CE33D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{04F6D258-F69C-4BB5-87C5-3813C3CE33D8}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {FBE5B0F6-5496-4BC5-BB38-CF16799DCF93}
30+
EndGlobalSection
31+
EndGlobal

sample/src/Egil.RazorComponents.Testing.Library.SampleApp.csproj renamed to sample/src/SampleApp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<IsPackable>false</IsPackable>
56
<RootNamespace>Egil.RazorComponents.Testing.SampleApp</RootNamespace>
67
</PropertyGroup>
78

sample/src/Startup.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
using Microsoft.Extensions.Configuration;
1010
using Microsoft.Extensions.DependencyInjection;
1111
using Microsoft.Extensions.Hosting;
12+
using System.Diagnostics.CodeAnalysis;
1213
using Egil.RazorComponents.Testing.SampleApp.Data;
1314

1415
namespace Egil.RazorComponents.Testing.SampleApp
1516
{
17+
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>")]
1618
public class Startup
1719
{
1820
public Startup(IConfiguration configuration)
@@ -22,6 +24,7 @@ public Startup(IConfiguration configuration)
2224

2325
public IConfiguration Configuration { get; }
2426

27+
2528
// This method gets called by the runtime. Use this method to add services to the container.
2629
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
2730
public void ConfigureServices(IServiceCollection services)

sample/tests/Assembly.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]

sample/tests/GlobalSuppressions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This file is used by Code Analysis to maintain SuppressMessage
2+
// attributes that are applied to this project.
3+
// Project-level suppressions either have no target or are given
4+
// a specific target and scoped to a namespace, type, member, etc.
5+
6+
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task", Justification = "<Pending>", Scope = "member", Target = "~M:Egil.RazorComponents.Testing.SampleApp.Tests.Components.AlertTest2.Test008~System.Threading.Tasks.Task")]

sample/tests/MockForecastService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Egil.RazorComponents.Testing.SampleApp
66
{
7-
internal class MockForecastService : IWeatherForecastService
8-
{
9-
public TaskCompletionSource<WeatherForecast[]> Task { get; } = new TaskCompletionSource<WeatherForecast[]>();
7+
internal class MockForecastService : IWeatherForecastService
8+
{
9+
public TaskCompletionSource<WeatherForecast[]> Task { get; } = new TaskCompletionSource<WeatherForecast[]>();
1010

11-
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate) => Task.Task;
12-
}
11+
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate) => Task.Task;
12+
}
1313
}

0 commit comments

Comments
 (0)