Skip to content

Commit fa8c511

Browse files
committed
sample tests
1 parent 567e0f0 commit fa8c511

Some content is hidden

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

57 files changed

+613
-204
lines changed

Razor.Components.Testing.Library.sln

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ 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", "{086B15CF-DF68-4228-BE4B-BEC8F671A0AA}"
22+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{26D90CB9-AF66-4F42-A16E-39D2CF69C8FB}"
2323
EndProject
24-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Egil.RazorComponents.Testing.Library.SampleApp", "sample\Egil.RazorComponents.Testing.Library.SampleApp.csproj", "{BA36AA08-E94D-4A26-91C1-DCB2A271636D}"
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}"
2527
EndProject
2628
Global
2729
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -37,18 +39,23 @@ Global
3739
{04E0142A-33CC-4E30-B903-F1370D94AD8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
3840
{04E0142A-33CC-4E30-B903-F1370D94AD8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
3941
{04E0142A-33CC-4E30-B903-F1370D94AD8C}.Release|Any CPU.Build.0 = Release|Any CPU
40-
{BA36AA08-E94D-4A26-91C1-DCB2A271636D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41-
{BA36AA08-E94D-4A26-91C1-DCB2A271636D}.Debug|Any CPU.Build.0 = Debug|Any CPU
42-
{BA36AA08-E94D-4A26-91C1-DCB2A271636D}.Release|Any CPU.ActiveCfg = Release|Any CPU
43-
{BA36AA08-E94D-4A26-91C1-DCB2A271636D}.Release|Any CPU.Build.0 = Release|Any CPU
42+
{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43+
{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
44+
{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
45+
{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE}.Release|Any CPU.Build.0 = Release|Any CPU
46+
{A7B05744-AA61-4F8E-8173-5DE812A4A745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47+
{A7B05744-AA61-4F8E-8173-5DE812A4A745}.Debug|Any CPU.Build.0 = Debug|Any CPU
48+
{A7B05744-AA61-4F8E-8173-5DE812A4A745}.Release|Any CPU.ActiveCfg = Release|Any CPU
49+
{A7B05744-AA61-4F8E-8173-5DE812A4A745}.Release|Any CPU.Build.0 = Release|Any CPU
4450
EndGlobalSection
4551
GlobalSection(SolutionProperties) = preSolution
4652
HideSolutionNode = FALSE
4753
EndGlobalSection
4854
GlobalSection(NestedProjects) = preSolution
4955
{AA96790B-67C9-4141-ACDB-037C8DC092EC} = {E006E9A4-F554-46DF-838F-812956521F64}
5056
{04E0142A-33CC-4E30-B903-F1370D94AD8C} = {C929375E-BD70-4B78-88C1-BDD1623C3365}
51-
{BA36AA08-E94D-4A26-91C1-DCB2A271636D} = {086B15CF-DF68-4228-BE4B-BEC8F671A0AA}
57+
{D1FE0F2A-D856-417E-A1FD-4ECE9C64D3AE} = {26D90CB9-AF66-4F42-A16E-39D2CF69C8FB}
58+
{A7B05744-AA61-4F8E-8173-5DE812A4A745} = {26D90CB9-AF66-4F42-A16E-39D2CF69C8FB}
5259
EndGlobalSection
5360
GlobalSection(ExtensibilityGlobals) = postSolution
5461
SolutionGuid = {24106918-1C86-4769-BDA6-9C80E64CD260}

sample/Pages/FetchData.razor

Lines changed: 0 additions & 46 deletions
This file was deleted.
File renamed without changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@using Egil.RazorComponents.Testing.Library.SampleApp.Data
2+
3+
<table class="table">
4+
<thead>
5+
<tr>
6+
<th>Date</th>
7+
<th>Temp. (C)</th>
8+
<th>Temp. (F)</th>
9+
<th>Summary</th>
10+
</tr>
11+
</thead>
12+
<tbody>
13+
@foreach (var forecast in Forecasts)
14+
{
15+
<tr>
16+
<td>@forecast.Date.ToShortDateString()</td>
17+
<td>@forecast.TemperatureC</td>
18+
<td>@forecast.TemperatureF</td>
19+
<td>@forecast.Summary</td>
20+
</tr>
21+
}
22+
</tbody>
23+
</table>
24+
@code{
25+
private WeatherForecast[] _forecasts = Array.Empty<WeatherForecast>();
26+
27+
[Parameter]
28+
public WeatherForecast[] Forecasts
29+
{
30+
get => _forecasts;
31+
set => _forecasts = value ?? Array.Empty<WeatherForecast>();
32+
}
33+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<li class="list-group-item list-group-item-action">
22
<div class="custom-control custom-checkbox">
3-
<input type="checkbox" class="custom-control-input" @bind=@Todo.IsDone>
3+
<input type="checkbox" class="custom-control-input" @bind=@Todo.IsDone />
44
<label class="custom-control-label">@Todo.Text</label>
55
<a class="float-right" href="#">(x)</a>
66
</div>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
4+
namespace Egil.RazorComponents.Testing.Library.SampleApp.Data
5+
{
6+
public interface IWeatherForecastService
7+
{
8+
Task<WeatherForecast[]> GetForecastAsync(DateTime startDate);
9+
}
10+
}

sample/src/Data/Todo.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Egil.RazorComponents.Testing.Library.SampleApp.Data
2+
{
3+
public class Todo
4+
{
5+
public int Id { get; set; }
6+
public string Text { get; set; } = string.Empty;
7+
public bool IsDone { get; set; }
8+
}
9+
}

sample/src/Data/TodoService.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Egil.RazorComponents.Testing.Library.SampleApp.Data
8+
{
9+
public class TodoService
10+
{
11+
public Task<Todo[]> Get()
12+
{
13+
return Task.FromResult(Array.Empty<Todo>());
14+
}
15+
16+
public void Add(Todo todo) { }
17+
public void Update(Todo todo) { }
18+
public void Delete(Todo todo) { }
19+
}
20+
}

0 commit comments

Comments
 (0)