Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" Version="4.11.7" />
<!-- Test dependencies -->
<PackageVersion Include="bunit" Version="1.38.5" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10128,7 +10128,7 @@
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentTooltip.Delay">
<summary>
Gets or sets the delay (in milliseconds).
Gets or sets the delay (in milliseconds).
Default is 300.
</summary>
</member>
Expand Down Expand Up @@ -10168,7 +10168,7 @@
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentTooltip.OnDismissed">
<summary>
Callback for when the tooltip is dismissed.
</summary>
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentTooltip.DrawTooltip">
<summary />
Expand Down
4 changes: 1 addition & 3 deletions tests/Core/Anchor/FluentAnchorTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Bunit;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Xunit;

Expand Down Expand Up @@ -148,11 +147,10 @@ public void FluentAnchor_TargetAttribute(string target)
// Assert
if (target == "invalid")
{
action.Should().Throw<ArgumentException>();
Assert.Throws< ArgumentException>(action);
}
else
{
action.Should().NotThrow();
cut!.Verify(suffix: target);
}
}
Expand Down
7 changes: 3 additions & 4 deletions tests/Core/Badge/FluentBadgeTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Bunit;
using FluentAssertions;

using Xunit;

namespace Microsoft.FluentUI.AspNetCore.Components.Tests.Badge;
Expand Down Expand Up @@ -42,11 +42,10 @@ public void FluentBadge_AppearanceAttribute(Appearance appearance)
// Assert
if (appearance == Appearance.Hypertext)
{
action.Should().Throw<ArgumentException>();
Assert.Throws<ArgumentException>(action);
}
else
{
action.Should().NotThrow();
cut!.Verify(suffix: appearance.ToString());
}
}
Expand All @@ -69,7 +68,7 @@ public void ThrowArgumentException_When_AppearanceAttributeValue_IsInvalid(Appea
};

// Assert
action.Should().ThrowExactly<ArgumentException>();
Assert.Throws<ArgumentException>(action);
}

[Fact]
Expand Down
5 changes: 2 additions & 3 deletions tests/Core/Breadcrumb/FluentBreadcrumbItemTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Bunit;
using FluentAssertions;

using Xunit;

namespace Microsoft.FluentUI.AspNetCore.Components.Tests.Breadcrumb;
Expand Down Expand Up @@ -133,11 +133,10 @@ public void FluentBreadcrumbItem_TargetAttribute(string targetAttribute)
// Assert
if (targetAttribute == "invalid")
{
action.Should().Throw<ArgumentException>();
Assert.Throws<ArgumentException>(action);
}
else
{
action.Should().NotThrow();
cut!.Verify(suffix: targetAttribute);
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Core/Button/FluentButtonTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Bunit;
using FluentAssertions;

using Microsoft.Extensions.DependencyInjection;
using Microsoft.FluentUI.AspNetCore.Components.Tests.Extensions;
using Xunit;
Expand Down Expand Up @@ -165,7 +165,7 @@ public void Throw_ArgumentException_When_FormTargetAttribute_IsInvalid(string? f
};

// Assert
action.Should().Throw<ArgumentException>();
Assert.Throws<ArgumentException>(action);
}

[Theory]
Expand Down
1 change: 0 additions & 1 deletion tests/Core/DataGrid/DataGridSortByTests.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using Bunit
@using FluentAssertions
@using Xunit

@inherits TestContext
Expand Down
17 changes: 8 additions & 9 deletions tests/Core/DataGrid/FluentDataGridTests.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using FluentAssertions
@using Xunit
@using Xunit
@inherits TestContext

@code {
Expand Down Expand Up @@ -43,14 +42,14 @@
</FluentDataGrid>);

// Assert
cut.Find("#loading-content").Should().NotBeNull();
Assert.NotNull(cut.Find("#loading-content"));
Assert.Throws<ElementNotFoundException>(() => cut.Find("#empty-content"));

cut.SetParametersAndRender(parameters => parameters
.Add(p => p.Loading, false));

Assert.Throws<ElementNotFoundException>(() => cut.Find("#loading-content"));
cut.Find("#empty-content").Should().NotBeNull();
Assert.NotNull(cut.Find("#empty-content"));
}

[Fact]
Expand All @@ -76,17 +75,17 @@

// Assert
var dataGrid = cut.Instance;
cut.Find("#loading-content").Should().NotBeNull();
Assert.NotNull(cut.Find("#loading-content"));

// should stay loading even after data refresh
await cut.InvokeAsync(() => dataGrid.RefreshDataAsync());
cut.Find("#loading-content").Should().NotBeNull();
Assert.NotNull(cut.Find("#loading-content"));

// now not loading but still with 0 items, should render empty content
cut.SetParametersAndRender(parameters => parameters
.Add(p => p.Loading, false));

cut.Find("#empty-content").Should().NotBeNull();
Assert.NotNull(cut.Find("#empty-content"));
}

[Fact]
Expand Down Expand Up @@ -117,7 +116,7 @@
var dataGrid = cut.Instance;

// Data is still loading, so loading content should be displayed
cut.Find("#loading-content").Should().NotBeNull();
Assert.NotNull(cut.Find("#loading-content"));

tcs.SetResult();

Expand All @@ -136,7 +135,7 @@
tcs = new TaskCompletionSource();
cut.SetParametersAndRender(parameters => parameters
.Add(p => p.Loading, null));
cut.Find("#loading-content").Should().NotBeNull();
Assert.NotNull(cut.Find("#loading-content"));

tcs.SetResult();

Expand Down
22 changes: 6 additions & 16 deletions tests/Core/DataGrid/GridSortTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using FluentAssertions;

using Xunit;

namespace Microsoft.FluentUI.AspNetCore.Components.Tests.DataGrid;
Expand All @@ -22,9 +22,7 @@ public void GridSortTests_SortBy_Number(bool ascending, IList<int> expected)
var sort = GridSort<GridRow>.ByAscending(x => x.Number);
var ordered = sort.Apply(_gridData.AsQueryable(), ascending);

ordered.Select(x => x.Number)
.SequenceEqual(expected)
.Should().BeTrue();
Assert.True(ordered.Select(x => x.Number).SequenceEqual(expected));
}

[Theory]
Expand All @@ -38,9 +36,7 @@ public void GridSortTests_SortBy_GroupThenNumberAscending(bool ascending, IList<

var ordered = sort.Apply(_gridData.AsQueryable(), ascending);

ordered.Select(x => x.Number)
.SequenceEqual(expected)
.Should().BeTrue();
Assert.True(ordered.Select(x => x.Number).SequenceEqual(expected));
}

[Theory]
Expand All @@ -54,9 +50,7 @@ public void GridSortTests_SortBy_GroupThenNumberDescending(bool ascending, IList

var ordered = sort.Apply(_gridData.AsQueryable(), ascending);

ordered.Select(x => x.Number)
.SequenceEqual(expected)
.Should().BeTrue();
Assert.True(ordered.Select(x => x.Number).SequenceEqual(expected));
}

[Theory]
Expand All @@ -70,9 +64,7 @@ public void GridSortTests_SortBy_GroupThenNumberAlwaysAscending(bool ascending,

var ordered = sort.Apply(_gridData.AsQueryable(), ascending);

ordered.Select(x => x.Number)
.SequenceEqual(expected)
.Should().BeTrue();
Assert.True(ordered.Select(x => x.Number).SequenceEqual(expected));
}

[Theory]
Expand All @@ -86,9 +78,7 @@ public void GridSortTests_SortBy_GroupThenNumberAlwaysDescending(bool ascending,

var ordered = sort.Apply(_gridData.AsQueryable(), ascending);

ordered.Select(x => x.Number)
.SequenceEqual(expected)
.Should().BeTrue();
Assert.True(ordered.Select(x => x.Number).SequenceEqual(expected));
}

#pragma warning restore CA1861 // Avoid constant arrays as arguments
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/FluentAssert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using AngleSharp.Dom;
using Bunit;
using Bunit.Rendering;
using FluentAssertions;

using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.FluentUI.AspNetCore.Components.Tests;
Expand Down
19 changes: 9 additions & 10 deletions tests/Core/List/FluentAutocompleteTests.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using FluentAssertions
@using Microsoft.FluentUI.AspNetCore.Components.Tests.Extensions
@using Microsoft.FluentUI.AspNetCore.Components.Tests.Extensions
@using Xunit;
@inherits TestContext
@code
Expand Down Expand Up @@ -260,11 +259,11 @@
var valueAttribute = textField.Attributes["value"];
var currentValueAttribute = textField.Attributes["current-value"];

valueAttribute.Should().NotBeNull();
valueAttribute!.Value.Should().Be("Preselected value");
Assert.NotNull(valueAttribute);
Assert.Equal("Preselected value", valueAttribute!.Value);

currentValueAttribute.Should().NotBeNull();
currentValueAttribute!.Value.Should().Be("Preselected value");
Assert.NotNull(currentValueAttribute);
Assert.Equal("Preselected value", currentValueAttribute!.Value);

cut.Verify();
}
Expand All @@ -280,13 +279,13 @@
parameters.Bind(p => p.ValueText, valueText, x => valueText = x);
});

valueText.Should().NotBeNullOrEmpty();
Assert.False(string.IsNullOrEmpty(valueText));

// Act
cut.Find("svg").Click(); // Clear button

// Assert
valueText.Should().BeNullOrEmpty();
Assert.True(string.IsNullOrEmpty(valueText));

cut.Verify();
}
Expand All @@ -305,7 +304,7 @@
cut.Find("svg").Click(); // Clear button

// Assert
cut.Find("fluent-anchored-region").Should().NotBeNull();
Assert.NotNull(cut.Find("fluent-anchored-region"));
cut.Verify();
}

Expand All @@ -324,7 +323,7 @@
cut.Find("svg").Click(); // Clear button

// Assert
cut.FindAll("fluent-anchored-region").Should().BeNullOrEmpty();
Assert.Empty(cut.FindAll("fluent-anchored-region"));
cut.Verify();
}

Expand Down
3 changes: 1 addition & 2 deletions tests/Core/List/FluentListboxTests.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using FluentAssertions
@using Microsoft.FluentUI.AspNetCore.Components.Tests.Extensions
@using Microsoft.FluentUI.AspNetCore.Components.Tests.Extensions
@using Xunit;
@inherits TestContext
@code
Expand Down
3 changes: 1 addition & 2 deletions tests/Core/List/FluentSelectTests.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using FluentAssertions
@using Microsoft.FluentUI.AspNetCore.Components.Tests.Extensions
@using Microsoft.FluentUI.AspNetCore.Components.Tests.Extensions
@using Xunit;
@inherits TestContext
@code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<ItemGroup>
<PackageReference Include="bunit" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
Expand Down
Loading
Loading