!2360 test(#I4SAKJ): add unit test for ajax

* test: 增加 Ajax 单元测试
This commit is contained in:
Argo 2022-01-26 08:14:28 +00:00
parent 4df42641cd
commit ba687fb0db

View File

@ -0,0 +1,26 @@
// 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 Microsoft.Extensions.DependencyInjection;
namespace UnitTest.Components;
public class AjaxTest : BootstrapBlazorTestBase
{
[Fact]
public void Ajax_Test()
{
var option = new AjaxOption
{
Url = "/api/Login",
Method = "POST",
Data = new { UserName = "admin", Password = "1234567" }
};
var service = Context.Services.GetRequiredService<AjaxService>();
_ = service.GetMessage(option);
_ = Context.RenderComponent<Ajax>();
_ = service.GetMessage(option);
}
}