diff --git a/tests/Core/Extensions/SampleIcons.cs b/tests/Core/Extensions/SampleIcons.cs index aa484d2b9c..249c6dcd6d 100644 --- a/tests/Core/Extensions/SampleIcons.cs +++ b/tests/Core/Extensions/SampleIcons.cs @@ -8,7 +8,7 @@ public static class SampleIcons public static readonly Icon PresenceAvailable = new Samples.PresenceAvailable(); - private class Samples + internal class Samples { internal class Info : Icon { public Info() : base("Info", IconVariant.Filled, IconSize.Size24, "") { } } diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_ButtonStart.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_ButtonStart.verified.razor.html new file mode 100644 index 0000000000..c0bbf4cbc8 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_ButtonStart.verified.razor.html @@ -0,0 +1,5 @@ + + + My Button \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Color.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Color.verified.razor.html new file mode 100644 index 0000000000..f430837c41 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Color.verified.razor.html @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_CustomColor.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_CustomColor.verified.razor.html new file mode 100644 index 0000000000..360a14d960 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_CustomColor.verified.razor.html @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Default.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Default.verified.razor.html new file mode 100644 index 0000000000..cd899d4eaa --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Default.verified.razor.html @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_FromImage.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_FromImage.verified.razor.html new file mode 100644 index 0000000000..f318d091d6 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_FromImage.verified.razor.html @@ -0,0 +1,4 @@ + +
+ +
\ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_ToMarkup.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_ToMarkup.verified.razor.html new file mode 100644 index 0000000000..5cf76e7aab --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_ToMarkup.verified.razor.html @@ -0,0 +1,6 @@ + +
+ +
\ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_ToMarkupColor.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_ToMarkupColor.verified.razor.html new file mode 100644 index 0000000000..d3b8496d01 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_ToMarkupColor.verified.razor.html @@ -0,0 +1,6 @@ + +
+ +
\ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_ToMarkupSize.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_ToMarkupSize.verified.razor.html new file mode 100644 index 0000000000..c356107c20 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_ToMarkupSize.verified.razor.html @@ -0,0 +1,6 @@ + +
+ +
\ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_WithColorRed.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_WithColorRed.verified.razor.html new file mode 100644 index 0000000000..03e5d9cbb9 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_WithColorRed.verified.razor.html @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_WithColorRed_OverridenByColor.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_WithColorRed_OverridenByColor.verified.razor.html new file mode 100644 index 0000000000..f430837c41 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_WithColorRed_OverridenByColor.verified.razor.html @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_WithColorSuccess.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_WithColorSuccess.verified.razor.html new file mode 100644 index 0000000000..4535566e81 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Icon_WithColorSuccess.verified.razor.html @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_SlotTitle.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_SlotTitle.verified.razor.html new file mode 100644 index 0000000000..8cc9c30672 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_SlotTitle.verified.razor.html @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Type.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Type.verified.razor.html new file mode 100644 index 0000000000..cd899d4eaa --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Type.verified.razor.html @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Type_Color.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Type_Color.verified.razor.html new file mode 100644 index 0000000000..f430837c41 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Type_Color.verified.razor.html @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.FluentIcon_Width.verified.razor.html b/tests/Core/Icons/FluentIconTests.FluentIcon_Width.verified.razor.html new file mode 100644 index 0000000000..325acc8c48 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.FluentIcon_Width.verified.razor.html @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/tests/Core/Icons/FluentIconTests.razor b/tests/Core/Icons/FluentIconTests.razor new file mode 100644 index 0000000000..345f4d0cf8 --- /dev/null +++ b/tests/Core/Icons/FluentIconTests.razor @@ -0,0 +1,206 @@ +@using Microsoft.FluentUI.AspNetCore.Components.Tests.Extensions +@using Xunit; +@inherits TestContext +@code +{ + [Fact] + public void FluentIcon_Default() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_Type() + { + // Arrange && Act + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_SlotTitle() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_Color() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_Type_Color() + { + // Arrange && Act + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_CustomColor() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_CustomColor_RequiresColorAttribute() + { + Assert.Throws(() => + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@); + + // Assert an exception because Color=Color.Custom is required + }); + } + + [Fact] + public void FluentIcon_Width() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_OnClick() + { + var isClicked = false; + + // Arrange + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@); + + // Act + cut.Find("svg").Click(); + + // Assert + Assert.True(isClicked); + } + + [Fact] + public void FluentIcon_ButtonStart() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@My Button); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_Icon_FromImage() + { + // Arrange && Act + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_Icon_FromEmptyImage() + { + // Arrange && Act + var icon = new IconFromImage(); + + // Assert + Assert.Empty(icon.Content); + + } + [Fact] + public void FluentIcon_Icon_WithColorRed() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_Icon_WithColorRed_OverridenByColor() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_Icon_WithColorSuccess() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_Icon_ToMarkup() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@
@icon.ToMarkup()
); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_Icon_ToMarkupSize() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@
@icon.ToMarkup(size: "100px")
); + + // Assert + cut.Verify(); + } + + [Fact] + public void FluentIcon_Icon_ToMarkupColor() + { + // Arrange && Act + var icon = new SampleIcons.Samples.Info(); + var cut = Render(@
@icon.ToMarkup(color: "blue")
); + + // Assert + cut.Verify(); + } +} \ No newline at end of file diff --git a/tests/Core/_ToDo/Icons/FluentIconTests.cs b/tests/Core/_ToDo/Icons/FluentIconTests.cs deleted file mode 100644 index 5f7938617d..0000000000 --- a/tests/Core/_ToDo/Icons/FluentIconTests.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Bunit; -using Microsoft.AspNetCore.Components.Web; -using Xunit; - -namespace Microsoft.FluentUI.AspNetCore.Components.Tests.Icons; - -public class FluentIconTests : TestBase -{ - [Fact(Skip = "Need to figure out how to do this test")] - public void FluentIcon_Default() - { - //Arrange - string slot = default!; - string title = default!; - Color? color = default!; - string customColor = default!; - string width = default!; - Icon value = default!; - Action onClick = _ => { }; - var cut = TestContext.RenderComponent>(parameters => parameters - .Add(p => p.Slot, slot) - .Add(p => p.Title, title) - .Add(p => p.Color, color) - .Add(p => p.CustomColor, customColor) - .Add(p => p.Width, width) - .Add(p => p.Value, value) - .Add(p => p.OnClick, onClick) - ); - //Act - - //Assert - cut.Verify(); - } -} \ No newline at end of file