Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,10 @@ jobs:

- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
dotnet-version: '3.1.x'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100-rc.1.20452.10'
- name: DOTNET HACK
shell: pwsh
run: |
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}

- name: Building library
run: dotnet build /p:PublicRelease=true
Expand Down
72 changes: 0 additions & 72 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@ jobs:
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100-rc.1.20452.10'
- name: Move .net SDK's to shared folder (hack)
shell: pwsh
run: |
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}

- name: Building library in release mode
run: dotnet build -c Release -p:ContinuousIntegrationBuild=true
Expand All @@ -71,18 +59,6 @@ jobs:
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100-rc.1.20452.10'
- name: Move .net SDK's to shared folder (hack)
shell: pwsh
run: |
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}

- name: Running unit tests
run: |
Expand Down Expand Up @@ -124,18 +100,6 @@ jobs:
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100-rc.1.20452.10'
- name: Move .net SDK's to shared folder (hack)
shell: pwsh
run: |
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}

- name: Creating library package
run: |
Expand Down Expand Up @@ -169,18 +133,6 @@ jobs:
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100-rc.1.20452.10'
- name: Move .net SDK's to shared folder (hack)
shell: pwsh
run: |
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}

- name: Install dotnet-format
run: dotnet tool install -g dotnet-format
Expand Down Expand Up @@ -238,18 +190,6 @@ jobs:
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100-rc.1.20452.10'
- name: Move .net SDK's to shared folder (hack)
shell: pwsh
run: |
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
Expand Down Expand Up @@ -296,18 +236,6 @@ jobs:
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.100-rc.1.20452.10'
- name: DOTNET HACK
shell: pwsh
run: |
$version = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Leaf;
$root = Split-Path (Split-Path $ENV:DOTNET_ROOT -Parent) -Parent;
$directories = Get-ChildItem $root | Where-Object { $_.Name -ne $version };
foreach ($dir in $directories) {
$from = $dir.FullName;
$to = "$root/$version";
Write-Host Copying from $from to $to;
Copy-Item "$from\*" $to -Recurse -Force;
}

- name: Creating library package for pre-release
if: github.event_name != 'release'
Expand Down
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,52 @@

All notable changes to **bUnit** will be documented in this file. The project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [UNRELEASED BETA 11]

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### Added
List of new features.

- Two new overloads to the `RenderFragment()` and `ChildContent()` component parameter factory methods have been added that takes a `RenderFragment` as input. By [@egil](https://github.com/egil) in [#203](https://github.com/egil/bUnit/pull/203).
- Added a `ComponentParameterCollection` type. The `ComponentParameterCollection` is a collection of component parameters, that knows how to turn those components parameters into a `RenderFragment`, which will render a component and pass any parameters inside the collection to that component. That logic was spread out over multiple places in bUnit, and is now owned by the `ComponentParameterCollection` type. By [@egil](https://github.com/egil) in [#203](https://github.com/egil/bUnit/pull/203).

### Changed
List of changes in existing functionality.

- The `ComponentParameterBuilder` has been renamed to `ComponentParameterCollectionBuilder`, since it now builds the `ComponentParameterCollection` type, introduced in this release of bUnit. By [@egil](https://github.com/egil) in [#203](https://github.com/egil/bUnit/pull/203).
- `ComponentParameterCollectionBuilder` now allows adding cascading values that is not directly used by the component type it targets. This makes it possible to add cascading values to children of the target component. By [@egil](https://github.com/egil) in [#203](https://github.com/egil/bUnit/pull/203).
- The `Add(object)` has been replaced by `AddCascadingValue(object)` in `ComponentParameterCollectionBuilder`, to make it more clear that an unnnamed cascading value is being passed to the target component or one of its child components. It it is also possible to pass unnamed cascading values using the `Add(parameterSelector, value)` method, which now correctly detect if the selected cascading value parameter is named or unnamed. By [@egil](https://github.com/egil) in [#203](https://github.com/egil/bUnit/pull/203).
- It is now possible to call the `Add()`, `AddChildContent()` methods on `ComponentParameterCollectionBuilder`, and the factory methods `RenderFragment()`, `ChildContent()`, and `Template()`, _**multiple times**_ for the same parameter, if it is of type `RenderFragment` or `RenderFragment<TValue>`. Doing so previously would either result in an exception or just the last passed `RenderFragment` to be used. Now all the provided `RenderFragment` or `RenderFragment<TValue>` will be combined at runtime into a single `RenderFragment` or `RenderFragment<TValue>`.

For example, this makes it easier to pass e.g. both a markup string and a component to a `ChildContent` parameter:

```csharp
var cut = ctx.RenderComponent<Component>(parameters => parameters
.AddChildContent("<h1>Below you will find a most interesting alert!</h1>")
.AddChildContent<Alert>(childParams => childParams
.Add(p => p.Heading, "Alert heading")
.Add(p => p.Type, AlertType.Warning)
.AddChildContent("<p>Hello World</p>")
)
);
```
By [@egil](https://github.com/egil) in [#203](https://github.com/egil/bUnit/pull/203).

### Deprecated
List of soon-to-be removed features.

### Removed
List of now removed features.

### Fixed
List of any bug fixes.

- Using the ComponentParameterCollectionBuilder's `Add(p => p.Param, value)` method to add a unnamed cascading value didn't create an unnnamed cascading value parameter. By [@egil](https://github.com/egil) in [#203](https://github.com/egil/bUnit/pull/203). Credits to [Ben Sampica (@benjaminsampica)](https://github.com/benjaminsampica) for reporting and helping investigate this issue.

### Security
List of fixed security vulnerabilities.

## [1.0.0-beta 10] - 2020-09-15

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
Expand Down
2 changes: 1 addition & 1 deletion docs/samples/tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>8.0</LangVersion>
<LangVersion>9.0</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion docs/samples/tests/mstest/BunitTestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void Dispose()
public IRenderedComponent<TComponent> RenderComponent<TComponent>(params ComponentParameter[] parameters) where TComponent : IComponent
=> _context?.RenderComponent<TComponent>(parameters) ?? throw new InvalidOperationException("MSTest has not started executing tests yet");

public IRenderedComponent<TComponent> RenderComponent<TComponent>(Action<ComponentParameterBuilder<TComponent>> parameterBuilder) where TComponent : IComponent
public IRenderedComponent<TComponent> RenderComponent<TComponent>(Action<ComponentParameterCollectionBuilder<TComponent>> parameterBuilder) where TComponent : IComponent
=> _context?.RenderComponent<TComponent>(parameterBuilder) ?? throw new InvalidOperationException("MSTest has not started executing tests yet");
}
}
1 change: 0 additions & 1 deletion docs/samples/tests/mstest/bunit.docs.mstest.samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../../../../src/bunit.core/bunit.core.csproj" />
<ProjectReference Include="../../../../src/bunit.web/bunit.web.csproj" />
<ProjectReference Include="../../components/bunit.docs.samples.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/samples/tests/nunit/BunitTestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void Dispose()
public IRenderedComponent<TComponent> RenderComponent<TComponent>(params ComponentParameter[] parameters) where TComponent : IComponent
=> _context?.RenderComponent<TComponent>(parameters) ?? throw new InvalidOperationException("NUnit has not started executing tests yet");

public IRenderedComponent<TComponent> RenderComponent<TComponent>(Action<ComponentParameterBuilder<TComponent>> parameterBuilder) where TComponent : IComponent
public IRenderedComponent<TComponent> RenderComponent<TComponent>(Action<ComponentParameterCollectionBuilder<TComponent>> parameterBuilder) where TComponent : IComponent
=> _context?.RenderComponent<TComponent>(parameterBuilder) ?? throw new InvalidOperationException("NUnit has not started executing tests yet");
}
}
1 change: 0 additions & 1 deletion docs/samples/tests/nunit/bunit.docs.nunit.samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../../../../src/bunit.core/bunit.core.csproj" />
<ProjectReference Include="../../../../src/bunit.web/bunit.web.csproj" />
<ProjectReference Include="../../components/bunit.docs.samples.csproj" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/tests/razor/AllKindsOfParamsTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@
<ComponentUnderTest>
<TemplateParams Items=@(new string[]{ "Foo", "Bar", "Baz" }) TItem="string">
<Template>
<div class="item">
<Item Value=@context></Item>
</div>
</Template>
</TemplateParams>
</ComponentUnderTest>
</Fixture>



<Fixture Test="f => {}">
<ComponentUnderTest>
<UnmatchedParams some-unknown-param="a value" />
Expand Down
5 changes: 2 additions & 3 deletions docs/samples/tests/razor/bunit.docs.razor.samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="bunit.core" Version="1.0.0-beta-10" />
<PackageReference Include="bunit.web" Version="1.0.0-beta-10" />
<PackageReference Include="bunit.xunit" Version="1.0.0-beta-10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
Expand All @@ -18,6 +15,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../../../../src/bunit.web/bunit.web.csproj" />
<ProjectReference Include="../../../../src/bunit.xunit/bunit.xunit.csproj" />
<ProjectReference Include="../../components/bunit.docs.samples.csproj" />
</ItemGroup>

Expand Down
Loading