From 2d7365100474ba8312b79276a63ea48b2cd7578e Mon Sep 17 00:00:00 2001 From: Nine <948825551@qq.com> Date: Fri, 31 Dec 2021 02:33:30 +0000 Subject: [PATCH] =?UTF-8?q?!2268=20test(#I4OV1A):=20add=20empty=20componen?= =?UTF-8?q?t=20unit=20tests=20*=20test:=20Empty=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/EmptyTest.cs | 85 +++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 test/UnitTest/Components/EmptyTest.cs diff --git a/test/UnitTest/Components/EmptyTest.cs b/test/UnitTest/Components/EmptyTest.cs new file mode 100644 index 000000000..8322db8c8 --- /dev/null +++ b/test/UnitTest/Components/EmptyTest.cs @@ -0,0 +1,85 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +using BootstrapBlazor.Components; +using Bunit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnitTest.Core; +using Xunit; + +namespace UnitTest.Components; + +public class EmptyTest : BootstrapBlazorTestBase +{ + + [Fact] + public void Image_Ok() + { + var path = "/src/image/argo.png"; + var cut = Context.RenderComponent(builder => builder.Add(p => p.Image, path)); + + Assert.Contains(path, cut.Markup); + } + + [Fact] + public void Text_Ok() + { + var text = "I am an Empty"; + var cut = Context.RenderComponent(builder => builder.Add(p => p.Text, text)); + + Assert.Contains(text, cut.Markup); + } + + [Fact] + public void Width_Ok() + { + var cut = Context.RenderComponent(builder => + { + builder.Add(p => p.Width, "200"); + builder.Add(i => i.Image, "/src/image/argo.png"); + }); + + Assert.Contains("width=\"200\"", cut.Markup); + } + + [Fact] + public void Height_Ok() + { + var cut = Context.RenderComponent(builder => + { + builder.Add(p => p.Height, "200"); + builder.Add(i => i.Image, "/src/image/argo.png"); + }); + + Assert.Contains("height=\"200\"", cut.Markup); + } + + [Fact] + public void ChildContent_Ok() + { + var cut = Context.RenderComponent(builder => builder.Add(p => p.ChildContent, r => + { + r.OpenComponent