From 132677f9d0a86d6128339ac1377ba4618765bb9b Mon Sep 17 00:00:00 2001 From: Argo Date: Thu, 23 Dec 2021 17:27:37 +0000 Subject: [PATCH] =?UTF-8?q?!2249=20test(#I4NWBH):=20add=20unit=20test=20?= =?UTF-8?q?=20for=20AmbiguousMatchException=20*=20chore:=20=20bump=20versi?= =?UTF-8?q?on=20to=206.1.1=20*=20test:=20=E5=A2=9E=E5=8A=A0=E4=BA=8C?= =?UTF-8?q?=E4=B9=89=E6=80=A7=E5=BC=82=E5=B8=B8=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20*=20fix:=20=E5=A2=9E=E5=8A=A0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=88=A4=E6=96=AD=20*=20fix:=20=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E5=AD=90=E7=B1=BB=20new=20=E5=A4=8D=E5=86=99=E7=88=B6?= =?UTF-8?q?=E7=B1=BB=E5=B1=9E=E6=80=A7=E6=83=85=E5=86=B5=20*=20test:=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=90=E7=B1=BB=E4=BD=BF=E7=94=A8=20new=20?= =?UTF-8?q?=E9=87=8D=E5=86=99=E7=88=B6=E7=B1=BB=E5=B1=9E=E6=80=A7=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95=20*=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=AD=90=E7=B1=BB=E4=BD=BF=E7=94=A8=20new=20=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=BA=8C=E4=B9=89=E6=80=A7=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=20*=20refactor:=20=E9=87=8D=E6=9E=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- test/UnitTest/Components/ValidateTest.cs | 33 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index dd1b72541..2a723d2c6 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 6.1.1-beta12 + 6.1.1 diff --git a/test/UnitTest/Components/ValidateTest.cs b/test/UnitTest/Components/ValidateTest.cs index c51754ade..f84a6d174 100644 --- a/test/UnitTest/Components/ValidateTest.cs +++ b/test/UnitTest/Components/ValidateTest.cs @@ -499,6 +499,28 @@ namespace UnitTest.Components }); } + [Fact] + public void Required_AmbiguousMatch() + { + var model = new Cat(); + var rules = new List + { + new FormItemValidator(new RequiredAttribute()) + }; + var cut = Context.RenderComponent(builder => + { + builder.Add(v => v.Model, model); + builder.AddChildContent>(pb => + { + pb.Add(v => v.Value, model.Foo); + pb.Add(v => v.ValueExpression, Utility.GenerateValueExpression(model, nameof(Cat.Foo), typeof(int))); + pb.Add(v => v.ValidateRules, rules); + }); + }); + + // 不会报错 AmbiguousMatchException + } + [Fact] public void TooltipHost_Ok() { @@ -532,5 +554,16 @@ namespace UnitTest.Components OnValidate(true); } } + + class Dummy + { + public virtual string? Foo { get; set; } + } + + class Cat : Dummy + { + [Required] + public new int Foo { get; set; } + } } }