"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[519],{5869:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>h,frontMatter:()=>t,metadata:()=>d,toc:()=>u});var s=r(5893),i=r(1151),c=r(510),l=r(4996);const t={id:"unittest",title:"36.1 \u5355\u5143/\u96c6\u6210\u6d4b\u8bd5",sidebar_label:"36.1 \u5355\u5143/\u96c6\u6210\u6d4b\u8bd5"},o=void 0,d={id:"unittest",title:"36.1 \u5355\u5143/\u96c6\u6210\u6d4b\u8bd5",description:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7",source:"@site/docs/unittest.mdx",sourceDirName:".",slug:"/unittest",permalink:"/docs/unittest",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/unittest.mdx",tags:[],version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1699252005,formattedLastUpdatedAt:"Nov 6, 2023",frontMatter:{id:"unittest",title:"36.1 \u5355\u5143/\u96c6\u6210\u6d4b\u8bd5",sidebar_label:"36.1 \u5355\u5143/\u96c6\u6210\u6d4b\u8bd5"},sidebar:"docs",previous:{title:"36. \u6d4b\u8bd5\u6307\u5357",permalink:"/docs/category/test"},next:{title:"36.2 \u8d1f\u8f7d\u538b\u6d4b",permalink:"/docs/performance"}},a={},u=[{value:"36.1.1 \u5173\u4e8e\u5355\u5143\u6d4b\u8bd5",id:"3611-\u5173\u4e8e\u5355\u5143\u6d4b\u8bd5",level:2},{value:"36.1.2 \u5355\u5143\u6d4b\u8bd5\u597d\u5904",id:"3612-\u5355\u5143\u6d4b\u8bd5\u597d\u5904",level:2},{value:"36.1.3 \u5355\u5143\u6d4b\u8bd5\u7c7b\u578b",id:"3613-\u5355\u5143\u6d4b\u8bd5\u7c7b\u578b",level:2},{value:"36.1.4 \u4e3b\u6d41\u7684\u5355\u5143\u6d4b\u8bd5\u5e93",id:"3614-\u4e3b\u6d41\u7684\u5355\u5143\u6d4b\u8bd5\u5e93",level:2},{value:"36.1.5 \u7b2c\u4e00\u4e2a\u4f8b\u5b50",id:"3615-\u7b2c\u4e00\u4e2a\u4f8b\u5b50",level:2},{value:"36.1.5.1 \u521b\u5efa xUnit
\u5355\u5143\u6d4b\u8bd5\u9879\u76ee",id:"36151-\u521b\u5efa-xunit-\u5355\u5143\u6d4b\u8bd5\u9879\u76ee",level:3},{value:"36.1.5.2 \u7b2c\u4e00\u4e2a\u6d4b\u8bd5\u65b9\u6cd5",id:"36152-\u7b2c\u4e00\u4e2a\u6d4b\u8bd5\u65b9\u6cd5",level:3},{value:"36.1.5.3 \u8fd0\u884c\u6d4b\u8bd5",id:"36153-\u8fd0\u884c\u6d4b\u8bd5",level:3},{value:"36.1.5.4 \u591a\u4e2a\u6d4b\u8bd5\u65b9\u6cd5\u6d4b\u8bd5",id:"36154-\u591a\u4e2a\u6d4b\u8bd5\u65b9\u6cd5\u6d4b\u8bd5",level:3},{value:"36.1.5.5 \u91cd\u590d/\u56de\u5f52\u6d4b\u8bd5",id:"36155-\u91cd\u590d\u56de\u5f52\u6d4b\u8bd5",level:3},{value:"36.1.6 \u96c6\u6210 Furion
\u5f3a\u5927\u529f\u80fd",id:"3616-\u96c6\u6210-furion-\u5f3a\u5927\u529f\u80fd",level:2},{value:"36.1.6.1 \u5b89\u88c5 Furion.Xunit
\u5305",id:"36161-\u5b89\u88c5-furionxunit-\u5305",level:3},{value:"36.1.6.2 \u6dfb\u52a0\u521d\u59cb\u914d\u7f6e\u7c7b",id:"36162-\u6dfb\u52a0\u521d\u59cb\u914d\u7f6e\u7c7b",level:3},{value:"36.1.6.3 \u4f7f\u7528 Furion
\u5b8c\u6574\u529f\u80fd",id:"36163-\u4f7f\u7528-furion-\u5b8c\u6574\u529f\u80fd",level:3},{value:"36.1.7 \u5e26\u53c2\u6570\u7684\u6d4b\u8bd5\u65b9\u6cd5",id:"3617-\u5e26\u53c2\u6570\u7684\u6d4b\u8bd5\u65b9\u6cd5",level:2},{value:"36.1.8 \u5982\u4f55\u8fdb\u884c\u4f9d\u8d56\u6ce8\u5165",id:"3618-\u5982\u4f55\u8fdb\u884c\u4f9d\u8d56\u6ce8\u5165",level:2},{value:"36.1.8.1 \u7f16\u5199\u4e00\u4e2a ICalcService
\u63a5\u53e3\u53ca\u5b9e\u73b0\u7c7b",id:"36181-\u7f16\u5199\u4e00\u4e2a-icalcservice-\u63a5\u53e3\u53ca\u5b9e\u73b0\u7c7b",level:3},{value:"36.1.8.2 \u5728\u6d4b\u8bd5\u7c7b\u4e2d\u8c03\u7528",id:"36182-\u5728\u6d4b\u8bd5\u7c7b\u4e2d\u8c03\u7528",level:3},{value:"36.1.8.3 \u8f93\u51fa\u65e5\u5fd7",id:"36183-\u8f93\u51fa\u65e5\u5fd7",level:3},{value:"36.1.8.4 \u5173\u4e8e\u4f9d\u8d56\u6ce8\u5165\u4f5c\u7528\u57df\u91ca\u653e",id:"36184-\u5173\u4e8e\u4f9d\u8d56\u6ce8\u5165\u4f5c\u7528\u57df\u91ca\u653e",level:3},{value:"36.1.8.5 \u6d4b\u8bd5\u91ca\u653e\u8d44\u6e90",id:"36185-\u6d4b\u8bd5\u91ca\u653e\u8d44\u6e90",level:3},{value:"36.1.8.6 [AssemblyFixture]
\u7279\u6027",id:"36186-assemblyfixture-\u7279\u6027",level:3},{value:"36.1.8.7 IClassFixture<>
\u5355\u4e2a\u6ce8\u5165",id:"36187-iclassfixture-\u5355\u4e2a\u6ce8\u5165",level:3},{value:"36.1.8.8 ICollectionFixture<>
\u591a\u4e2a\u6ce8\u5165",id:"36188-icollectionfixture-\u591a\u4e2a\u6ce8\u5165",level:3},{value:"36.1.9 Web
\u96c6\u6210\u6d4b\u8bd5",id:"3619-web-\u96c6\u6210\u6d4b\u8bd5",level:2},{value:"36.1.9.1 \u5bf9\u73b0\u6709\u9879\u76ee\u8fdb\u884c\u96c6\u6210\u6d4b\u8bd5",id:"36191-\u5bf9\u73b0\u6709\u9879\u76ee\u8fdb\u884c\u96c6\u6210\u6d4b\u8bd5",level:3},{value:"36.1.9.2 \u72ec\u7acb\u4e3b\u673a\u65b9\u5f0f\u6d4b\u8bd5",id:"36192-\u72ec\u7acb\u4e3b\u673a\u65b9\u5f0f\u6d4b\u8bd5",level:3},{value:"36.1.9.3 \u7cfb\u7edf\u96c6\u6210/\u73af\u5883/\u914d\u7f6e\u90e8\u7f72\u6d4b\u8bd5",id:"36193-\u7cfb\u7edf\u96c6\u6210\u73af\u5883\u914d\u7f6e\u90e8\u7f72\u6d4b\u8bd5",level:3},{value:"36.1.9.4 \u96c6\u6210 Furion.Xunit
\u62d3\u5c55",id:"36194-\u96c6\u6210-furionxunit-\u62d3\u5c55",level:3},{value:"36.1.10 Assert
\u65ad\u8a00",id:"36110-assert-\u65ad\u8a00",level:2},{value:"36.1.11 \u5355\u5143\u6d4b\u8bd5\u8986\u76d6\u7387",id:"36111-\u5355\u5143\u6d4b\u8bd5\u8986\u76d6\u7387",level:2},{value:"36.1.12 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"36112-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function x(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",h2:"h2",h3:"h3",hr:"hr",li:"li",mdxAdmonitionTitle:"mdxAdmonitionTitle",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.a)(),...e.components},{Details:r}=n;return r||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(r,{children:[(0,s.jsx)("summary",{children:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7"}),(0,s.jsx)("div",{children:(0,s.jsx)("div",{children:(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"\u95ee\u9898\u4fee\u590d"})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\xa0",(0,s.jsx)(c.Z,{children:"\u4fee\u590d"})," ",(0,s.jsx)(n.code,{children:"Furion.Xunit/Furion.Pure.Xunit"})," \u5355\u5143\u6d4b\u8bd5\u4f9d\u8d56\u6ce8\u5165\u5355\u4f8b\u670d\u52a1\u65f6\u4e0d\u662f\u540c\u4e00\u5b9e\u4f8b\u95ee\u9898 ",(0,s.jsx)("sup",{children:"4.8.5.3"})," ",(0,s.jsx)("sup",{children:"\u23f1\ufe0f2023.01.31"})," ",(0,s.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/305511ec6322019622c392a23957042d2dcae7fb",children:"305511e"})]}),"\n"]}),"\n"]}),"\n"]})})})]}),"\n","\n","\n",(0,s.jsx)(n.h2,{id:"3611-\u5173\u4e8e\u5355\u5143\u6d4b\u8bd5",children:"36.1.1 \u5173\u4e8e\u5355\u5143\u6d4b\u8bd5"}),"\n",(0,s.jsx)(n.p,{children:"\u5f15\u7528\u81ea\u767e\u5ea6\u767e\u79d1\uff1a"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsx)(n.p,{children:"\u5355\u5143\u6d4b\u8bd5\uff08unit testing\uff09\uff0c\u662f\u6307\u5bf9\u8f6f\u4ef6\u4e2d\u7684\u6700\u5c0f\u53ef\u6d4b\u8bd5\u5355\u5143\u8fdb\u884c\u68c0\u67e5\u548c\u9a8c\u8bc1\u3002\u5bf9\u4e8e\u5355\u5143\u6d4b\u8bd5\u4e2d\u5355\u5143\u7684\u542b\u4e49\uff0c\u4e00\u822c\u6765\u8bf4\uff0c\u8981\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u53bb\u5224\u5b9a\u5176\u5177\u4f53\u542b\u4e49\uff0c\u5982 C \u8bed\u8a00\u4e2d\u5355\u5143\u6307\u4e00\u4e2a\u51fd\u6570\uff0cJava \u91cc\u5355\u5143\u6307\u4e00\u4e2a\u7c7b\uff0c\u56fe\u5f62\u5316\u7684\u8f6f\u4ef6\u4e2d\u53ef\u4ee5\u6307\u4e00\u4e2a\u7a97\u53e3\u6216\u4e00\u4e2a\u83dc\u5355\u7b49\u3002\u603b\u7684\u6765\u8bf4\uff0c\u5355\u5143\u5c31\u662f\u4eba\u4e3a\u89c4\u5b9a\u7684\u6700\u5c0f\u7684\u88ab\u6d4b\u529f\u80fd\u6a21\u5757\u3002\u5355\u5143\u6d4b\u8bd5\u662f\u5728\u8f6f\u4ef6\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u8981\u8fdb\u884c\u7684\u6700\u4f4e\u7ea7\u522b\u7684\u6d4b\u8bd5\u6d3b\u52a8\uff0c\u8f6f\u4ef6\u7684\u72ec\u7acb\u5355\u5143\u5c06\u5728\u4e0e\u7a0b\u5e8f\u7684\u5176\u4ed6\u90e8\u5206\u76f8\u9694\u79bb\u7684\u60c5\u51b5\u4e0b\u8fdb\u884c\u6d4b\u8bd5\u3002"}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"3612-\u5355\u5143\u6d4b\u8bd5\u597d\u5904",children:"36.1.2 \u5355\u5143\u6d4b\u8bd5\u597d\u5904"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u6d88\u706d\u4f4e\u7ea7\u9519\u8bef"})}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u57fa\u672c\u7684\u5355\u5143\u6d4b\u8bd5\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u6d4b\u8bd5\u4e4b\u524d\uff0c\u628a\u5927\u90e8\u5206\u6bd4\u8f83\u4f4e\u7ea7\u7684\u9519\u8bef\u90fd\u6d88\u706d\u6389\uff0c\u51cf\u5c11\u7cfb\u7edf\u6d4b\u8bd5\u8fc7\u7a0b\u4e2d\u7684\u95ee\u9898\uff0c\u8fd9\u6837\u4e5f\u5c31\u51cf\u5c11\u4e86\u7cfb\u7edf\u6d4b\u8bd5\u4e2d\u5b9a\u4f4d\u548c\u89e3\u51b3\u95ee\u9898\u7684\u65f6\u95f4\u6210\u672c\u4e86\u3002"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u627e\u51fa\u6f5c\u5728\u7684 bug"})}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u67d0\u4e9b\u7c7b\u578b\u7684 bug\uff0c\u9760\u7cfb\u7edf\u6d4b\u8bd5\u662f\u5f88\u96be\u627e\u5230\u7684\u3002\u4f8b\u5982\u4e00\u4e9b\u4ee3\u7801\u5206\u652f\uff0c\u5e73\u65f6 99%\u7684\u573a\u666f\u57fa\u672c\u4e0a\u90fd\u8d70\u4e0d\u5230\uff0c\u4f46\u4e00\u65e6\u8d70\u5230\u4e86\uff0c\u5982\u679c\u6ca1\u6709\u63d0\u524d\u6d4b\u8bd5\u597d\uff0c\u90a3\u4e48\u53ef\u80fd\u5c31\u662f\u4e00\u4e2a\u707e\u96be\u3002"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u4e0a\u7ebf\u524d\u7684\u4fdd\u8bc1"})}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u52a0\u4e86\u65b0\u4ee3\u7801\uff0c\u4e0a\u7ebf\u524d\u8dd1\u4e00\u628a\u5355\u5143\u6d4b\u8bd5\uff0c\u90fd\u901a\u8fc7\uff0c\u8bf4\u660e\u4ee3\u7801\u53ef\u80fd\u6ca1\u6709\u5f71\u54cd\u5230\u4e4b\u524d\u7684\u903b\u8f91\uff0c\u8fd9\u6837\u4e0a\u7ebf\u4e5f\u6bd4\u8f83\u653e\u5fc3\u3002\u5982\u679c\u4e4b\u524d\u7684\u5355\u5143\u6d4b\u8bd5\u8dd1\u4e0d\u8fc7\uff0c\u90a3\u4e48\u5f88\u6709\u53ef\u80fd\u65b0\u7684\u4ee3\u7801\u6709\u6f5c\u5728\u7684\u95ee\u9898\uff0c\u8d76\u7d27\u4fee\u590d\u53bb\u5427\u3002"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u91cd\u6784\u4ee3\u7801\u7684\u673a\u4f1a"})}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u5199\u5355\u5143\u6d4b\u8bd5\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f60\u53ef\u80fd\u4f1a\u987a\u624b\u628a\u4e00\u4e9b code \u91cd\u6784\u4e86\uff0c\u4e3a\u4ec0\u4e48\uff1f\u4e3e\u4f8b\uff0c\u4e00\u4e9b\u957f\u5f97\u975e\u5e38\u50cf\u7684\u4ee3\u7801\uff0c\u5982\u679c\u6bcf\u6b21\u90fd\u8981\u5199\u4e00\u5806\u6d4b\u8bd5\u4ee3\u7801\u53bb\u6d4b\u540c\u6837\u7684 code\uff0c\u4f60\u4f1a\u4e0d\u4f1a\u6293\u72c2\uff1f\u4e0d\u6d4b\u5427\uff0c\u8986\u76d6\u7387\u53c8\u4e0a\u4e0d\u53bb\uff0c\u4e8e\u662f\u6211\u5c31\u4f1a\u60f3\u65b9\u8bbe\u6cd5\u628a\u5f85\u6d4b\u8bd5\u7684 code \u6539\u5f97\u5c3d\u91cf\u7684\u7cbe\u7b80\uff0c\u91cd\u590d\u4ee3\u7801\u51cf\u5c11\uff0c\u8fd9\u6837\u8986\u76d6\u7387\u4e0a\u53bb\u4e86\uff0c\u6d4b\u8bd5\u4e5f\u597d\u6d4b\u4e86\uff0c\u4ee3\u7801\u4e5f\u7b80\u6d01\u4e86\u3002\u5982\u679c\u6ca1\u6709\u5355\u5143\u6d4b\u8bd5\u548c\u8986\u76d6\u7387\u7684\u8981\u6c42\u7684\u8bdd\uff0c\u5766\u767d\u8bf4\u53ef\u80fd\u4e00\u6765\u81ea\u5df1\u4e0d\u4f1a\u53d1\u73b0\u8fd9\u4e9b\u91cd\u590d\u7684 code\uff0c\u53e6\u4e00\u65b9\u9762\u5373\u4f7f\u53d1\u73b0\u4e86\uff0c\u53ef\u80fd\u4e5f\u6ca1\u6709\u592a\u5927\u7684\u52a8\u529b\u53bb\u6539\u8fdb\u3002"}),"\n",(0,s.jsx)(n.p,{children:"\u53e6\u5916\uff0c\u7531\u4e8e\u5355\u5143\u6d4b\u8bd5\u4e2d\uff0c\u4f60\u9700\u8981\u5c1d\u8bd5\u53bb\u8986\u76d6\u4e00\u4e9b\u5f02\u5e38\u5206\u652f\uff0c\u8fd9\u662f\u7cfb\u7edf\u6d4b\u8bd5\u5e38\u5e38\u8d70\u4e0d\u5230\u7684\u5730\u65b9\uff0c\u4e8e\u662f\u5c31\u4f1a\u5f15\u8d77\u4f60\u7684\u4e00\u4e9b\u601d\u8003\uff0c\u4f8b\u5982\u8fd9\u4e2a\u5f02\u5e38\u5206\u652f\u662f\u5426\u771f\u7684\u9700\u8981\uff1f\u662f\u5426\u771f\u7684\u4f1a\u53d1\u751f\uff1f\u5bf9\u4e8e\u4e00\u4e9b\u5b9e\u9645\u4e0a\u7edd\u5bf9\u4e0d\u4f1a\u51fa\u9519\u7684\u51fd\u6570\uff0c\u90a3\u4e48\u6211\u89c9\u5f97\u53ef\u80fd\u5f02\u5e38\u5206\u652f\u662f\u6ca1\u5fc5\u8981\u5b58\u5728\u7684\u3002"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u91cd\u65b0 review \u4ee3\u7801\u7684\u673a\u4f1a"})}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"\u5199 UT \u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u603b\u662f\u4f1a\u597d\u597d\u770b\u54ea\u4e9b\u4ee3\u7801\u6267\u884c\u5230\u4e86\uff0c\u54ea\u4e9b\u4ee3\u7801\u6ca1\u6709\u6267\u884c\u5230\uff0c\u8fd9\u5176\u5b9e\u4e5f\u662f\u4e00\u4e2a review \u81ea\u5df1\u4ee3\u7801\u7684\u673a\u4f1a\uff0c\u6709\u4e9b\u65f6\u5019\uff0c\u5e76\u4e0d\u662f UT \u672c\u8eab\u5e2e\u6211\u627e\u5230 bug\uff0c\u800c\u662f\u56de\u5934 review \u81ea\u5df1\u4ee3\u7801\u7684\u65f6\u5019\u53d1\u73b0\u7684\u3002"}),"\n",(0,s.jsx)(n.h2,{id:"3613-\u5355\u5143\u6d4b\u8bd5\u7c7b\u578b",children:"36.1.3 \u5355\u5143\u6d4b\u8bd5\u7c7b\u578b"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"\u57fa\u4e8e API \u63a5\u53e3\u6d4b\u8bd5\uff08\u767d\u76d2 + \u6d45\u5ea6\u9ed1\u76d2\u6d4b\u8bd5\uff09"}),"\n",(0,s.jsx)(n.li,{children:"\u57fa\u4e8e\u9879\u76ee\u4ee3\u7801\u6d4b\u8bd5\uff08\u6df1\u5ea6\u767d\u76d2\u6d4b\u8bd5\uff09"}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"3614-\u4e3b\u6d41\u7684\u5355\u5143\u6d4b\u8bd5\u5e93",children:"36.1.4 \u4e3b\u6d41\u7684\u5355\u5143\u6d4b\u8bd5\u5e93"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"xUnit"}),"\uff08",(0,s.jsx)(n.strong,{children:"\u6700\u6d41\u884c\u7684\u5e93\uff0c\u63a8\u8350"}),"\uff09"]}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"NUnit"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:"MSTest"})}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsxs)(n.strong,{children:["\u5728\u672c\u7ae0\u8282\uff0c",(0,s.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u4f7f\u7528 ",(0,s.jsx)(n.code,{children:"xUnit"})," \u5e93\u8fdb\u884c\u5355\u5143\u6d4b\u8bd5\u3002"]})}),"\n",(0,s.jsx)(n.h2,{id:"3615-\u7b2c\u4e00\u4e2a\u4f8b\u5b50",children:"36.1.5 \u7b2c\u4e00\u4e2a\u4f8b\u5b50"}),"\n",(0,s.jsxs)(n.h3,{id:"36151-\u521b\u5efa-xunit-\u5355\u5143\u6d4b\u8bd5\u9879\u76ee",children:["36.1.5.1 \u521b\u5efa ",(0,s.jsx)(n.code,{children:"xUnit"})," \u5355\u5143\u6d4b\u8bd5\u9879\u76ee"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut1.png")}),"\n",(0,s.jsx)(n.h3,{id:"36152-\u7b2c\u4e00\u4e2a\u6d4b\u8bd5\u65b9\u6cd5",children:"36.1.5.2 \u7b2c\u4e00\u4e2a\u6d4b\u8bd5\u65b9\u6cd5"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,7,10}",children:"using Xunit;\r\n\r\nnamespace TestProject1\r\n{\r\n public class UnitTest1\r\n {\r\n [Fact]\r\n public void Test1()\r\n {\r\n Assert.Equal(2, 1 + 1);\r\n }\r\n }\r\n}\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u5355\u5143\u6d4b\u8bd5\u5b9e\u9645\u4e0a\u662f\u901a\u8fc7\u666e\u901a\u7684\u7c7b\u7684\u65b9\u6cd5\u8fdb\u884c\u6a21\u5757\u529f\u80fd\u6d4b\u8bd5\uff0c\u5177\u4f53\u6d4b\u8bd5\u5219\u662f\u6807\u8bb0\u4e86 ",(0,s.jsx)(n.code,{children:"[Fact]"})," \u7279\u6027\u7684\u65b9\u6cd5\uff0c\u5728\u65b9\u6cd5\u4e2d\u4f7f\u7528 ",(0,s.jsx)(n.code,{children:"Assert"})," \u7c7b\u63d0\u4f9b\u7684\u9759\u6001\u65b9\u6cd5\u8fdb\u884c ",(0,s.jsx)(n.code,{children:"\u65ad\u8a00"}),"\uff0c",(0,s.jsx)(n.code,{children:"\u65ad\u8a00"})," \u6210\u529f\uff0c\u5219\u6d4b\u8bd5\u901a\u8fc7\uff0c\u5426\u5219\u6d4b\u8bd5\u4e0d\u901a\u8fc7\u3002"]}),"\n",(0,s.jsx)(n.h3,{id:"36153-\u8fd0\u884c\u6d4b\u8bd5",children:"36.1.5.3 \u8fd0\u884c\u6d4b\u8bd5"}),"\n",(0,s.jsxs)(n.p,{children:["\u5728\u5355\u5143\u6d4b\u8bd5\u9879\u76ee\u4e2d ",(0,s.jsx)(n.code,{children:"\u53f3\u952e"})," \u9009\u62e9 ",(0,s.jsx)(n.code,{children:"\u8fd0\u884c\u6d4b\u8bd5"})," \u5e76\u6253\u5f00 ",(0,s.jsx)(n.code,{children:"\u6d4b\u8bd5\u8d44\u6e90\u7ba1\u7406\u5668"})," \u5373\u53ef\u67e5\u770b\u6d4b\u8bd5\u7ed3\u679c\u3002"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut2.png")}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut3.png")}),"\n",(0,s.jsx)(n.h3,{id:"36154-\u591a\u4e2a\u6d4b\u8bd5\u65b9\u6cd5\u6d4b\u8bd5",children:"36.1.5.4 \u591a\u4e2a\u6d4b\u8bd5\u65b9\u6cd5\u6d4b\u8bd5"}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut4.png")}),"\n",(0,s.jsx)(n.h3,{id:"36155-\u91cd\u590d\u56de\u5f52\u6d4b\u8bd5",children:"36.1.5.5 \u91cd\u590d/\u56de\u5f52\u6d4b\u8bd5"}),"\n",(0,s.jsxs)(n.p,{children:["\u540e\u7eed\u6dfb\u52a0\u66f4\u591a\u6d4b\u8bd5\u65b9\u6cd5\u53ea\u9700\u5728 ",(0,s.jsx)(n.code,{children:"\u6d4b\u8bd5\u8d44\u6e90\u7ba1\u7406\u5668"})," \u70b9\u51fb ",(0,s.jsx)(n.code,{children:"\u5728\u89c6\u56fe\u4e2d\u8fd0\u884c\u6240\u6709\u6d4b\u8bd5"})," \u64ad\u653e\u6309\u94ae\u5373\u53ef\uff0c\u5982\u4e0b\u56fe"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut5.png")}),"\n",(0,s.jsxs)(n.h2,{id:"3616-\u96c6\u6210-furion-\u5f3a\u5927\u529f\u80fd",children:["36.1.6 \u96c6\u6210 ",(0,s.jsx)(n.code,{children:"Furion"})," \u5f3a\u5927\u529f\u80fd"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"Furion"})," \u662f\u8de8\u5e73\u53f0\u3001\u8de8\u9879\u76ee\u7684\u5f00\u53d1\u6846\u67b6\uff0c\u652f\u6301\u4efb\u610f\u9879\u76ee\u7c7b\u578b\uff0c\u5305\u62ec\u5355\u5143\u6d4b\u8bd5\u9879\u76ee\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"36161-\u5b89\u88c5-furionxunit-\u5305",children:["36.1.6.1 \u5b89\u88c5 ",(0,s.jsx)(n.code,{children:"Furion.Xunit"})," \u5305"]}),"\n",(0,s.jsxs)(n.admonition,{type:"note",children:[(0,s.jsxs)(n.mdxAdmonitionTitle,{children:[(0,s.jsx)(n.code,{children:"Furion"})," \u7eaf\u51c0\u7248"]}),(0,s.jsxs)(n.p,{children:["\u5982\u679c\u4f7f\u7528\u7684\u662f ",(0,s.jsx)(n.code,{children:"Furion.Pure"})," \u5219\u5b89\u88c5 ",(0,s.jsx)(n.code,{children:"Furion.Pure.Xunit"})," \u8fd9\u4e2a\u62d3\u5c55\u5305\u3002"]})]}),"\n",(0,s.jsxs)(n.p,{children:["\u6253\u5f00 ",(0,s.jsx)(n.code,{children:"NuGet"})," \u7a0b\u5e8f\u5305\u63a7\u5236\u53f0\uff0c\u5b89\u88c5 ",(0,s.jsx)(n.code,{children:"Furion.Xunit"})," \u5305"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut6.png")}),"\n",(0,s.jsx)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"Furion.Xunit"})," \u5df2\u7ecf\u5305\u542b ",(0,s.jsx)(n.code,{children:"Furion"})," \u65e0\u9700\u518d\u6b21\u5b89\u88c5 ",(0,s.jsx)(n.code,{children:"Furion"}),"\u3002"]})}),"\n",(0,s.jsx)(n.h3,{id:"36162-\u6dfb\u52a0\u521d\u59cb\u914d\u7f6e\u7c7b",children:"36.1.6.2 \u6dfb\u52a0\u521d\u59cb\u914d\u7f6e\u7c7b"}),"\n",(0,s.jsxs)(n.p,{children:["\u5728\u5355\u5143\u6d4b\u8bd5\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u6dfb\u52a0 ",(0,s.jsx)(n.code,{children:"TestProgram.cs"})," \u7c7b\uff0c\u5e76\u5199\u4e0b\u4ee5\u4e0b\u4ee3\u7801\uff1a"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:'showLineNumbers {6,13,18} title="TestProgram.cs"',children:'using Furion.Xunit;\r\nusing Xunit.Abstractions;\r\nusing Xunit.Sdk;\r\n\r\n// \u914d\u7f6e\u542f\u52a8\u7c7b\u7c7b\u578b\uff0c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f TestProgram \u7c7b\u5b8c\u6574\u9650\u5b9a\u540d\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u5f53\u524d\u9879\u76ee\u7a0b\u5e8f\u96c6\u540d\u79f0\r\n[assembly: TestFramework("TestProject1.TestProgram", "TestProject1")]\r\n\r\nnamespace TestProject1;\r\n\r\n/// \r\n/// \u5355\u5143\u6d4b\u8bd5\u542f\u52a8\u7c7b\r\n/// \r\npublic class TestProgram : TestStartup\r\n{\r\n public TestProgram(IMessageSink messageSink) : base(messageSink)\r\n {\r\n // \u521d\u59cb\u5316 Furion\r\n Serve.RunNative();\r\n }\r\n}\n'})}),"\n",(0,s.jsx)(n.admonition,{title:"\u5c0f\u63d0\u793a",type:"tip",children:(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"TestProgram.cs"})," \u540d\u79f0\u53ef\u968f\u610f\uff0c\u53ea\u9700\u8981\u7ee7\u627f ",(0,s.jsx)(n.code,{children:"TestStartup"})," \u7c7b\u5373\u53ef\u3002",(0,s.jsxs)(n.strong,{children:["\u4f46\u7c7b\u578b\u5fc5\u987b\u662f ",(0,s.jsx)(n.code,{children:"public"})," \u516c\u5f00\u7684"]}),"\u3002"]})}),"\n",(0,s.jsxs)(n.h3,{id:"36163-\u4f7f\u7528-furion-\u5b8c\u6574\u529f\u80fd",children:["36.1.6.3 \u4f7f\u7528 ",(0,s.jsx)(n.code,{children:"Furion"})," \u5b8c\u6574\u529f\u80fd"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"Furion"})," \u662f\u8de8\u5e73\u53f0\u3001\u8de8\u9879\u76ee\u7684\u5f00\u53d1\u6846\u67b6\uff0c\u4e0b\u9762\u5728\u5355\u5143\u6d4b\u8bd5\u4e2d\u6f14\u793a ",(0,s.jsx)(n.code,{children:"\u8fdc\u7a0b\u8bf7\u6c42"})," \u5e76\u8bf7\u6c42 ",(0,s.jsx)(n.code,{children:"https://www.baidu.com"})," \u6570\u636e\uff0c\u5e76\u6d4b\u8bd5\u662f\u5426\u8bf7\u6c42\u6210\u529f\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"Furion"})," \u63d0\u4f9b\u4e86\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u6ce8\u518c\u670d\u52a1\uff1a"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"Serve.RunNative"})," \u65b9\u5f0f\uff08",(0,s.jsx)(n.strong,{children:"\u63a8\u8350"}),"\uff09"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,4}",children:"Serve.RunNative(services =>\r\n{\r\n // \u6ce8\u518c\u8fdc\u7a0b\u670d\u52a1\r\n services.AddRemoteRequest();\r\n});\n"})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"Startup.cs"})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:'showLineNumbers {8,13} title="Startup.cs"',children:"using Furion;\r\nusing Microsoft.AspNetCore.Builder;\r\nusing Microsoft.AspNetCore.Hosting;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace TestProject1;\r\n\r\npublic class Startup : AppStartup\r\n{\r\n public void ConfigureServices(IServiceCollection services)\r\n {\r\n // \u6ce8\u518c\u8fdc\u7a0b\u670d\u52a1\r\n services.AddRemoteRequest();\r\n }\r\n\r\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\r\n {\r\n }\r\n}\n"})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"\u7f16\u5199\u6d4b\u8bd5\u65b9\u6cd5"}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'[Fact]\r\npublic async Task \u6d4b\u8bd5\u8bf7\u6c42\u767e\u5ea6()\r\n{\r\n var rep = await "https://www.baidu.com".GetAsync();\r\n Assert.True(rep.IsSuccessStatusCode);\r\n}\n'})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:"\u67e5\u770b\u6d4b\u8bd5\u7ed3\u679c"}),"\n"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut7.png")}),"\n",(0,s.jsxs)(n.p,{children:["\u5f88\u795e\u5947\u5427\uff01",(0,s.jsx)(n.code,{children:"Furion"})," \u652f\u6301\u4efb\u4f55\u9879\u76ee\u7c7b\u578b\uff0c\u4efb\u4f55\u5e73\u53f0\u4f7f\u7528\u3002"]}),"\n",(0,s.jsx)(n.h2,{id:"3617-\u5e26\u53c2\u6570\u7684\u6d4b\u8bd5\u65b9\u6cd5",children:"36.1.7 \u5e26\u53c2\u6570\u7684\u6d4b\u8bd5\u65b9\u6cd5"}),"\n",(0,s.jsxs)(n.p,{children:["\u4e0a\u9762\u4f8b\u5b50\u4e2d\uff0c\u6d4b\u8bd5\u65b9\u6cd5\u90fd\u662f\u6ca1\u6709\u53c2\u6570\u7684\uff0c\u6709\u65f6\u5019\u9700\u8981\u540c\u4e00\u4e2a\u65b9\u6cd5\u8f93\u5165\u591a\u4e2a\u4e0d\u540c\u7684\u503c\u8fdb\u884c\u6d4b\u8bd5\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u7528\u5230 ",(0,s.jsx)(n.code,{children:"[Theory]"})," \u548c ",(0,s.jsx)(n.code,{children:"[InlineData]"})," \u7279\u6027\u4e86\u3002"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\uff0c\u4e0b\u9762\u6d4b\u8bd5\u4e24\u4e2a\u6570\u7684\u548c\u662f ",(0,s.jsx)(n.code,{children:"\u5947\u6570"}),"\uff0c\u6d4b\u8bd5\u4ee3\u7801\u5982\u4e0b\uff1a"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1-4}",children:"[Theory]\r\n[InlineData(1, 2)]\r\n[InlineData(3, 4)]\r\n[InlineData(5, 7)]\r\npublic void \u5e26\u53c2\u6570\u6d4b\u8bd5(int i, int j)\r\n{\r\n Assert.NotEqual(0, (i + j) % 2);\r\n}\n"})}),"\n",(0,s.jsx)(n.p,{children:"\u6d4b\u8bd5\u7ed3\u679c\uff1a"}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut8.png")}),"\n",(0,s.jsx)(n.h2,{id:"3618-\u5982\u4f55\u8fdb\u884c\u4f9d\u8d56\u6ce8\u5165",children:"36.1.8 \u5982\u4f55\u8fdb\u884c\u4f9d\u8d56\u6ce8\u5165"}),"\n",(0,s.jsxs)(n.p,{children:["\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u6d4b\u8bd5\u67d0\u63a5\u53e3\uff0c\u6216\u8005\u8fdb\u884c\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f\u89e3\u6790\u670d\u52a1\u5e76\u8c03\u7528\uff0c",(0,s.jsx)(n.code,{children:"Furion.Xunit"})," \u63d0\u4f9b\u5b8c\u6574\u7684\u6784\u9020\u51fd\u6570\u6ce8\u5165\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"36181-\u7f16\u5199\u4e00\u4e2a-icalcservice-\u63a5\u53e3\u53ca\u5b9e\u73b0\u7c7b",children:["36.1.8.1 \u7f16\u5199\u4e00\u4e2a ",(0,s.jsx)(n.code,{children:"ICalcService"})," \u63a5\u53e3\u53ca\u5b9e\u73b0\u7c7b"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {5,10}",children:"using Furion.DependencyInjection;\r\n\r\nnamespace TestProject1.Services;\r\n\r\npublic interface ICalcService\r\n{\r\n int Plus(int i, int j);\r\n}\r\n\r\npublic class CalcService : ICalcService, ITransient // \u652f\u6301\u4efb\u4f55\u751f\u547d\u5468\u671f\r\n{\r\n public int Plus(int i, int j)\r\n {\r\n return i + j;\r\n }\r\n}\n"})}),"\n",(0,s.jsx)(n.h3,{id:"36182-\u5728\u6d4b\u8bd5\u7c7b\u4e2d\u8c03\u7528",children:"36.1.8.2 \u5728\u6d4b\u8bd5\u7c7b\u4e2d\u8c03\u7528"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {9,15,17}",children:"using TestProject1.Services;\r\nusing Xunit;\r\n\r\nnamespace TestProject1;\r\n\r\npublic class UnitTest1\r\n{\r\n private readonly ICalcService _calcService;\r\n public UnitTest1(ICalcService calcService)\r\n {\r\n _calcService = calcService;\r\n }\r\n\r\n [Fact]\r\n public void \u6d4b\u8bd5\u4e24\u4e2a\u6570\u7684\u548c()\r\n {\r\n Assert.Equal(3, _calcService.Plus(1, 2));\r\n }\r\n}\n"})}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut9.png")}),"\n",(0,s.jsx)(n.h3,{id:"36183-\u8f93\u51fa\u65e5\u5fd7",children:"36.1.8.3 \u8f93\u51fa\u65e5\u5fd7"}),"\n",(0,s.jsxs)(n.p,{children:["\u5982\u679c\u5728\u5355\u5143\u6d4b\u8bd5\u4e2d\u60f3\u8f93\u51fa\u65e5\u5fd7\uff0c\u53ea\u9700\u8981\u5728\u6784\u9020\u51fd\u6570\u6ce8\u5165 ",(0,s.jsx)(n.code,{children:"ITestOutputHelper"})," \u5373\u53ef\uff0c\u5982\uff1a"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,10,12,18}",children:'using Xunit;\r\nusing Xunit.Abstractions;\r\n\r\nnamespace TestProject1\r\n{\r\n public class UnitTest1\r\n {\r\n private readonly ITestOutputHelper Output;\r\n\r\n public UnitTest1(ITestOutputHelper tempOutput)\r\n {\r\n Output = tempOutput;\r\n }\r\n\r\n [Fact]\r\n public void Test_String_Equal()\r\n {\r\n Output.WriteLine("\u54c8\u54c8\u54c8\u54c8\uff0c\u6211\u662f Furion");\r\n Assert.NotEqual("Furion", "Fur");\r\n }\r\n }\r\n}\n'})}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/un3.png")}),"\n",(0,s.jsx)(n.h3,{id:"36184-\u5173\u4e8e\u4f9d\u8d56\u6ce8\u5165\u4f5c\u7528\u57df\u91ca\u653e",children:"36.1.8.4 \u5173\u4e8e\u4f9d\u8d56\u6ce8\u5165\u4f5c\u7528\u57df\u91ca\u653e"}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"Furion"})," \u4f1a\u5728\u521b\u5efa\u5355\u5143\u6d4b\u8bd5\u5b9e\u4f8b\u65f6\u521b\u5efa\u4e00\u4e2a ",(0,s.jsx)(n.code,{children:"IServiceScope"})," \u5bf9\u8c61\uff0c\u7b49\u8be5\u5b9e\u4f8b\u6240\u6709\u6d4b\u8bd5\u6848\u4f8b\u6267\u884c\u5b8c\u6bd5\u81ea\u52a8\u8c03\u7528 ",(0,s.jsx)(n.code,{children:"Dispose"}),"\uff0c\u7f16\u5199\u6d4b\u8bd5\u7684\u5f00\u53d1\u8005\u65e0\u9700\u5173\u6ce8\u3002"]}),"\n",(0,s.jsx)(n.h3,{id:"36185-\u6d4b\u8bd5\u91ca\u653e\u8d44\u6e90",children:"36.1.8.5 \u6d4b\u8bd5\u91ca\u653e\u8d44\u6e90"}),"\n",(0,s.jsxs)(n.p,{children:["\u6709\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u6d4b\u8bd5\u6210\u529f\u540e\u91ca\u653e\u4e00\u4e9b\u4e0d\u80fd\u53ca\u65f6\u91ca\u653e\u7684\u5bf9\u8c61\uff0c\u8fd9\u65f6\uff0c\u53ea\u9700\u8981\u5b9e\u73b0 ",(0,s.jsx)(n.code,{children:"IDisposable"})," \u63a5\u53e3\u5373\u53ef\uff1a"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {6,14-17}",children:'using System;\r\nusing Xunit;\r\n\r\nnamespace TestProject1\r\n{\r\n public class UnitTest1 : IDisposable\r\n {\r\n [Fact]\r\n public void Test_String_Equal()\r\n {\r\n Assert.NotEqual("Furion", "Fur");\r\n }\r\n\r\n public void Dispose()\r\n {\r\n // \u91ca\u653e\u4f60\u7684\u5bf9\u8c61\r\n }\r\n }\r\n}\n'})}),"\n",(0,s.jsxs)(n.h3,{id:"36186-assemblyfixture-\u7279\u6027",children:["36.1.8.6 ",(0,s.jsx)(n.code,{children:"[AssemblyFixture]"})," \u7279\u6027"]}),"\n",(0,s.jsxs)(n.p,{children:["\u6709\u65f6\u5019\u6211\u4eec\u53ef\u80fd\u4e0d\u9700\u8981\u5bf9\u7c7b\u8fdb\u884c\u4f9d\u8d56\u6ce8\u518c\uff0c\u6216\u8005\u65e0\u6cd5\u901a\u8fc7\u5916\u90e8\u8fdb\u884c\u6ce8\u518c\uff0c\u8fd9\u65f6\u5019\u53ef\u4ee5\u901a\u8fc7 ",(0,s.jsx)(n.code,{children:"[AssemblyFixture]"})," \u7279\u6027\u5b9e\u73b0\u6784\u9020\u51fd\u6570\u6ce8\u5165\u4efb\u4f55\u7c7b\uff0c\u5982\uff1a"]}),"\n",(0,s.jsx)(n.admonition,{title:"\u6709\u6548\u8303\u56f4\u8bf4\u660e",type:"important",children:(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"[AssemblyFixture]"})," \u65b9\u5f0f\u5bf9\u6574\u4e2a\u5355\u5143\u6d4b\u8bd5\u7c7b\u6784\u9020\u51fd\u6570\u90fd\u6709\u6548\uff0c\u5982\u9700\u4e2a\u522b\u5355\u5143\u6d4b\u8bd5\u7c7b\u6709\u6548\u53ef\u4f7f\u7528 ",(0,s.jsx)(n.code,{children:"IClassFixture<>"})," \u6216 ",(0,s.jsx)(n.code,{children:"ICollectionFixture<>"})," + ",(0,s.jsx)(n.code,{children:"[Collection]"})," \u7ec4\u5408\u65b9\u5f0f\u3002"]})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u5b9a\u4e49\u9700\u8981\u6ce8\u5165\u8fdb\u5355\u5143\u6d4b\u8bd5\u6784\u9020\u51fd\u6570\u4e2d\u7684\u7c7b"})}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1}",children:"public class MyAssemblyFixture : IDisposable\r\n{\r\n public static int InstantiationCount;\r\n\r\n public MyAssemblyFixture()\r\n {\r\n InstantiationCount++;\r\n }\r\n\r\n public void Dispose()\r\n {\r\n // \u505a\u4e00\u4e9b\u91ca\u653e\u5de5\u4f5c\r\n }\r\n}\n"})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsxs)(n.strong,{children:["\u5728 ",(0,s.jsx)(n.code,{children:"TestProgram.cs"})," \u9876\u90e8\u5168\u5c40\u6ce8\u518c"]})}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:'showLineNumbers {11} title="TestProgram.cs"',children:'using Furion.Xunit;\r\nusing TestProject1;\r\nusing Xunit;\r\nusing Xunit.Abstractions;\r\nusing Xunit.Sdk;\r\n\r\n// \u914d\u7f6e\u542f\u52a8\u7c7b\u7c7b\u578b\uff0c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f TestProgram \u7c7b\u5b8c\u6574\u9650\u5b9a\u540d\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u5f53\u524d\u9879\u76ee\u7a0b\u5e8f\u96c6\u540d\u79f0\r\n[assembly: TestFramework("TestProject1.TestProgram", "TestProject1")]\r\n\r\n// \u652f\u6301\u591a\u4e2a\r\n[assembly: AssemblyFixture(typeof(MyAssemblyFixture))]\r\n// [assembly: AssemblyFixture(typeof(XXXXFixture))]\r\n\r\nnamespace TestProject1;\r\n\r\n/// \r\n/// \u5355\u5143\u6d4b\u8bd5\u542f\u52a8\u7c7b\r\n/// \r\npublic class TestProgram : TestStartup\r\n{\r\n public TestProgram(IMessageSink messageSink) : base(messageSink)\r\n {\r\n Serve.Run(silence: true);\r\n }\r\n}\n'})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u5728\u6d4b\u8bd5\u7c7b\u6784\u9020\u51fd\u6570\u6ce8\u5165"})}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {12,27}",children:"using TestProject1.Services;\r\nusing Xunit;\r\n\r\nnamespace TestProject1;\r\n\r\npublic class UnitTest1\r\n{\r\n private readonly ICalcService _calcService;\r\n private readonly MyAssemblyFixture _fixture;\r\n\r\n public UnitTest1(ICalcService calcService\r\n , MyAssemblyFixture fixture)\r\n {\r\n _calcService = calcService;\r\n _fixture = fixture;\r\n }\r\n\r\n [Fact]\r\n public void \u6d4b\u8bd5\u4e24\u4e2a\u6570\u7684\u548c()\r\n {\r\n Assert.Equal(3, _calcService.Plus(1, 2));\r\n }\r\n\r\n [Fact]\r\n public void EnsureSingleton()\r\n {\r\n Assert.Equal(1, MyAssemblyFixture.InstantiationCount);\r\n }\r\n}\n"})}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut10.png")}),"\n",(0,s.jsxs)(n.h3,{id:"36187-iclassfixture-\u5355\u4e2a\u6ce8\u5165",children:["36.1.8.7 ",(0,s.jsx)(n.code,{children:"IClassFixture<>"})," \u5355\u4e2a\u6ce8\u5165"]}),"\n",(0,s.jsxs)(n.p,{children:["\u901a\u8fc7\u4e0a\u9762 ",(0,s.jsx)(n.code,{children:"[AssemblyFixture]"})," \u65b9\u5f0f\u6211\u4eec\u77e5\u9053\u6b64\u65b9\u5f0f\u5bf9\u5168\u5c40\u7684\u5355\u5143\u6d4b\u8bd5\u7c7b\u90fd\u6709\u6548\uff0c\u4f46\u6709\u65f6\u5019\u6211\u4eec\u53ea\u9700\u8981\u7279\u5b9a\u5355\u5143\u6d4b\u8bd5\u7c7b\u6709\u6548\uff0c\u5219\u53ef\u901a\u8fc7 ",(0,s.jsx)(n.code,{children:"IClassFixture<>"})," \u65b9\u5f0f\uff0c\u5982\uff1a"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u5b9a\u4e49\u9700\u8981\u6ce8\u5165\u8fdb\u5355\u5143\u6d4b\u8bd5\u6784\u9020\u51fd\u6570\u4e2d\u7684\u7c7b"})}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1}",children:"public class MyClassFixture : IDisposable\r\n{\r\n public static int InstantiationCount;\r\n\r\n public MyClassFixture()\r\n {\r\n InstantiationCount++;\r\n }\r\n\r\n public void Dispose()\r\n {\r\n // \u505a\u4e00\u4e9b\u91ca\u653e\u5de5\u4f5c\r\n }\r\n}\n"})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u5728\u6d4b\u8bd5\u7c7b\u6784\u9020\u51fd\u6570\u6ce8\u5165"})}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {6,14,34}",children:"using TestProject1.Services;\r\nusing Xunit;\r\n\r\nnamespace TestProject1;\r\n\r\npublic class UnitTest1 : IClassFixture\r\n{\r\n private readonly ICalcService _calcService;\r\n private readonly MyAssemblyFixture _fixture;\r\n private readonly MyClassFixture _classFixture;\r\n\r\n public UnitTest1(ICalcService calcService\r\n , MyAssemblyFixture fixture\r\n , MyClassFixture classFixture)\r\n {\r\n _calcService = calcService;\r\n _fixture = fixture;\r\n _classFixture = classFixture;\r\n }\r\n\r\n [Fact]\r\n public void \u6d4b\u8bd5\u4e24\u4e2a\u6570\u7684\u548c()\r\n {\r\n Assert.Equal(3, _calcService.Plus(1, 2));\r\n }\r\n\r\n [Fact]\r\n public void EnsureSingleton()\r\n {\r\n Assert.Equal(1, MyAssemblyFixture.InstantiationCount);\r\n }\r\n\r\n [Fact]\r\n public void EnsureClassSingleton()\r\n {\r\n Assert.Equal(1, MyClassFixture.InstantiationCount);\r\n }\r\n}\n"})}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut11.png")}),"\n",(0,s.jsxs)(n.h3,{id:"36188-icollectionfixture-\u591a\u4e2a\u6ce8\u5165",children:["36.1.8.8 ",(0,s.jsx)(n.code,{children:"ICollectionFixture<>"})," \u591a\u4e2a\u6ce8\u5165"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"ICollectionFixture<>"})," \u65b9\u5f0f\u548c ",(0,s.jsx)(n.code,{children:"IClassFixture<>"})," \u65b9\u5f0f\u6700\u5927\u7684\u4e0d\u540c\u5c31\u662f\u540e\u8005\u53ea\u80fd\u914d\u7f6e\u4e3a\u5355\u4e2a\u6d4b\u8bd5\u7c7b\u4f7f\u7528\uff0c\u800c ",(0,s.jsx)(n.code,{children:"ICollectionFixture<>"})," \u5219\u901a\u8fc7 ",(0,s.jsx)(n.code,{children:"[Collection]"})," \u65b9\u5f0f\u914d\u7f6e\u591a\u4e2a\u6d4b\u8bd5\u7c7b\u6709\u6548\uff0c\u5982\uff1a"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u5b9a\u4e49\u9700\u8981\u6ce8\u5165\u8fdb\u5355\u5143\u6d4b\u8bd5\u6784\u9020\u51fd\u6570\u4e2d\u7684\u7c7b"})}),"\n"]}),"\n",(0,s.jsx)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:(0,s.jsxs)(n.p,{children:["\u8fd9\u91cc\u533a\u522b\u4e8e ",(0,s.jsx)(n.code,{children:"IClassFixture<>"})," \u65b9\u5f0f\uff0c\u9700\u5b9a\u4e49\u914d\u7f6e\u5668\u5e76\u5b9e\u73b0 ",(0,s.jsx)(n.code,{children:"ICollectionFixture<>"})," \u63a5\u53e3\u3002"]})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {5,20-21}",children:'using Xunit;\r\n\r\nnamespace TestProject1;\r\n\r\npublic class MyCollectionFixture : IDisposable\r\n{\r\n public static int InstantiationCount;\r\n\r\n public MyCollectionFixture()\r\n {\r\n InstantiationCount++;\r\n }\r\n\r\n public void Dispose()\r\n {\r\n // \u505a\u4e00\u4e9b\u91ca\u653e\u5de5\u4f5c\r\n }\r\n}\r\n\r\n[CollectionDefinition("MyCollection")]\r\npublic class MyCollection : ICollectionFixture\r\n{\r\n}\n'})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.strong,{children:"\u5728\u6d4b\u8bd5\u7c7b\u6784\u9020\u51fd\u6570\u6ce8\u5165"})}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {6,17,44}",children:'using TestProject1.Services;\r\nusing Xunit;\r\n\r\nnamespace TestProject1;\r\n\r\n[Collection("MyCollection")]\r\npublic class UnitTest1 : IClassFixture\r\n{\r\n private readonly ICalcService _calcService;\r\n private readonly MyAssemblyFixture _fixture;\r\n private readonly MyClassFixture _classFixture;\r\n private readonly MyCollectionFixture _collectionFixture;\r\n\r\n public UnitTest1(ICalcService calcService\r\n , MyAssemblyFixture fixture\r\n , MyClassFixture classFixture\r\n , MyCollectionFixture collectionFixture)\r\n {\r\n _calcService = calcService;\r\n _fixture = fixture;\r\n _classFixture = classFixture;\r\n _collectionFixture = collectionFixture;\r\n }\r\n\r\n [Fact]\r\n public void \u6d4b\u8bd5\u4e24\u4e2a\u6570\u7684\u548c()\r\n {\r\n Assert.Equal(3, _calcService.Plus(1, 2));\r\n }\r\n\r\n [Fact]\r\n public void EnsureSingleton()\r\n {\r\n Assert.Equal(1, MyAssemblyFixture.InstantiationCount);\r\n }\r\n\r\n [Fact]\r\n public void EnsureClassSingleton()\r\n {\r\n Assert.Equal(1, MyClassFixture.InstantiationCount);\r\n }\r\n\r\n [Fact]\r\n public void EnsureCollectionSingleton()\r\n {\r\n Assert.Equal(1, MyCollectionFixture.InstantiationCount);\r\n }\r\n}\n'})}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut12.png")}),"\n",(0,s.jsxs)(n.h2,{id:"3619-web-\u96c6\u6210\u6d4b\u8bd5",children:["36.1.9 ",(0,s.jsx)(n.code,{children:"Web"})," \u96c6\u6210\u6d4b\u8bd5"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"Web"})," \u96c6\u6210\u6d4b\u8bd5\u6709\u4e09\u79cd\u65b9\u5f0f\uff0c\u901a\u8fc7\u8fd9\u4e09\u79cd\u65b9\u5f0f\u53ef\u4ee5\u5bf9\u9879\u76ee\u8fdb\u884c\u5168\u65b9\u4f4d\u7684\u6d4b\u8bd5\uff0c\u4fdd\u8bc1\u90e8\u7f72\u4e0a\u7ebf\u662f\u6d4b\u8bd5\u671f\u76fc\u6548\u679c\u3002"]}),"\n",(0,s.jsx)(n.h3,{id:"36191-\u5bf9\u73b0\u6709\u9879\u76ee\u8fdb\u884c\u96c6\u6210\u6d4b\u8bd5",children:"36.1.9.1 \u5bf9\u73b0\u6709\u9879\u76ee\u8fdb\u884c\u96c6\u6210\u6d4b\u8bd5"}),"\n",(0,s.jsx)(n.p,{children:"\u8fd9\u79cd\u65b9\u5f0f\u6bd4\u8f83\u7b80\u5355\uff0c\u4e5f\u662f\u6700\u5e38\u7528\u7684\u65b9\u5f0f\uff0c\u65e0\u9700\u90e8\u7f72\u5230\u670d\u52a1\u5668\u76f4\u63a5\u5728\u672c\u5730\u5373\u53ef\u6d4b\u8bd5\uff0c\u5982\uff1a"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\u521b\u5efa ",(0,s.jsx)(n.code,{children:"Xunit"})," \u5355\u5143\u6d4b\u8bd5\u9879\u76ee"]}),"\n"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut1.png")}),"\n",(0,s.jsxs)(n.ol,{start:"2",children:["\n",(0,s.jsxs)(n.li,{children:["\u6dfb\u52a0 ",(0,s.jsx)(n.code,{children:"Microsoft.AspNetCore.Mvc.Testing"})," \u5fae\u8f6f\u63d0\u4f9b\u7684\u96c6\u6210\u6d4b\u8bd5\u62d3\u5c55"]}),"\n"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut13.png")}),"\n",(0,s.jsxs)(n.ol,{start:"3",children:["\n",(0,s.jsxs)(n.li,{children:["\u6dfb\u52a0\u6d4b\u8bd5\u9879\u76ee\u6216\u4f7f\u7528\u5df2\u6709\u7684\u6d4b\u8bd5\u9879\u76ee",(0,s.jsx)(n.strong,{children:"\u5f15\u7528"})]}),"\n"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut14.png")}),"\n",(0,s.jsxs)(n.ol,{start:"4",children:["\n",(0,s.jsxs)(n.li,{children:["\u914d\u7f6e ",(0,s.jsx)(n.code,{children:"Web"})," \u9879\u76ee\u542f\u52a8\u5c42"]}),"\n"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:".NET5"})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\u5728\u9700\u8981\u6d4b\u8bd5\u7684 ",(0,s.jsx)(n.code,{children:"Web"})," \u9879\u76ee\u542f\u52a8\u5c42\u6dfb\u52a0 ",(0,s.jsx)(n.code,{children:"FakeStarup.cs"})," \u7c7b"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:'showLineNumbers title="FakeStarup.cs"',children:"namespace WebApplication1;\r\n\r\n/// \r\n/// \u4f9b\u96c6\u6210\u6d4b\u8bd5\u4f7f\u7528\r\n/// \r\npublic class FakeStartup\r\n{\r\n}\n"})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.code,{children:".NET6+"})}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\uff08",(0,s.jsx)(n.code,{children:".NET6+"}),"\uff09\u7f16\u8f91 ",(0,s.jsx)(n.code,{children:"WebApplication1.csproj"}),"\uff0c\u6dfb\u52a0 ",(0,s.jsx)(n.code,{children:''})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-xml",metastring:"showLineNumbers {2}",children:'\r\n \r\n\n'})}),"\n",(0,s.jsxs)(n.p,{children:["\uff08",(0,s.jsx)(n.code,{children:".NET6+"}),"\uff09\u7f16\u8f91 ",(0,s.jsx)(n.code,{children:"Program.cs"})," \u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"public partial class Program { }\n"})}),"\n",(0,s.jsxs)(n.ol,{start:"5",children:["\n",(0,s.jsxs)(n.li,{children:["\u7f16\u5199\u6d4b\u8bd5 ",(0,s.jsx)(n.code,{children:"Web"})," \u9879\u76ee\u63a5\u53e3\u6d4b\u8bd5\u6848\u4f8b"]}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {6,8-12,15,16}",children:'using Microsoft.AspNetCore.Mvc.Testing;\r\nusing Xunit;\r\n\r\nnamespace TestProject2;\r\n\r\npublic class UnitTest1 : IClassFixture>\r\n{\r\n private readonly WebApplicationFactory _factory;\r\n public UnitTest1(WebApplicationFactory factory)\r\n {\r\n _factory = factory;\r\n }\r\n\r\n [Theory]\r\n [InlineData("/default")]\r\n public async Task TestEnsureSuccessStatusCode(string url)\r\n {\r\n using var client = _factory.CreateClient();\r\n using var response = await client.GetAsync(url);\r\n response.EnsureSuccessStatusCode();\r\n }\r\n}\n'})}),"\n",(0,s.jsxs)(n.admonition,{title:"\u4e3b\u673a\u66f4\u591a\u914d\u7f6e\u8bf4\u660e",type:"note",children:[(0,s.jsx)(n.p,{children:"\u5982\u9700\u6dfb\u52a0\u66f4\u591a\u914d\u7f6e\uff0c\u5982\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\uff0c\u53ef\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\uff1a"}),(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {11-14}",children:'using Microsoft.AspNetCore.Hosting;\r\nusing Microsoft.AspNetCore.Mvc.Testing;\r\n\r\nnamespace TestProject2;\r\n\r\npublic class UnitTest1 : IClassFixture>\r\n{\r\n private readonly WebApplicationFactory _factory;\r\n public UnitTest1(WebApplicationFactory factory)\r\n {\r\n _factory = factory.WithWebHostBuilder(builder =>\r\n {\r\n builder.UseEnvironment("Stage"); // \u8bbe\u7f6e\u73af\u5883\r\n });\r\n }\r\n\r\n // ....\r\n}\n'})})]}),"\n",(0,s.jsxs)(n.admonition,{type:"tip",children:[(0,s.jsxs)(n.mdxAdmonitionTitle,{children:[(0,s.jsx)(n.code,{children:".NET6+"})," \u6cdb\u578b\u53c2\u6570"]}),(0,s.jsxs)(n.p,{children:["\u5982\u679c\u662f ",(0,s.jsx)(n.code,{children:".NET6+(\u542b)"}),"\uff0c\u53ea\u9700\u8981\u5c06 ",(0,s.jsx)(n.code,{children:"WebApplicationFactory"})," \u6cdb\u578b\u53c2\u6570\u6539\u4e3a\uff1a",(0,s.jsx)(n.code,{children:"WebApplicationFactory"})," \u5373\u53ef\u3002"]})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"/default"})," \u63a5\u53e3\u5bf9\u5e94\u63a7\u5236\u5668\u5b9a\u4e49\u5982\u4e0b\uff1a"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {10,12}",children:'using Microsoft.AspNetCore.Mvc;\r\n\r\nnamespace WebApplication1.Controllers\r\n{\r\n [ApiController]\r\n [Route("[controller]")]\r\n public class DefaultController : ControllerBase\r\n {\r\n [HttpGet]\r\n public string Get()\r\n {\r\n return "Furion \u96c6\u6210\u6d4b\u8bd5";\r\n }\r\n }\r\n}\n'})}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut15.png")}),"\n",(0,s.jsxs)(n.ol,{start:"6",children:["\n",(0,s.jsx)(n.li,{children:"\u5141\u8bb8\u6d4b\u8bd5"}),"\n"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut16.png")}),"\n",(0,s.jsx)(n.h3,{id:"36192-\u72ec\u7acb\u4e3b\u673a\u65b9\u5f0f\u6d4b\u8bd5",children:"36.1.9.2 \u72ec\u7acb\u4e3b\u673a\u65b9\u5f0f\u6d4b\u8bd5"}),"\n",(0,s.jsx)(n.p,{children:"\u72ec\u7acb\u4e3b\u673a\u7684\u65b9\u5f0f\u5c31\u662f\u5229\u7528\u5355\u5143\u6d4b\u8bd5\u7684\u6bcf\u4e00\u4e2a\u6d4b\u8bd5\u6848\u4f8b\u6784\u5efa\u4e3b\u673a\u8fdb\u884c\u6d4b\u8bd5\u3002"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\u521b\u5efa ",(0,s.jsx)(n.code,{children:"Xunit"})," \u5355\u5143\u6d4b\u8bd5\u9879\u76ee"]}),"\n"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut1.png")}),"\n",(0,s.jsxs)(n.ol,{start:"2",children:["\n",(0,s.jsxs)(n.li,{children:["\u6dfb\u52a0 ",(0,s.jsx)(n.code,{children:"Microsoft.AspNetCore.Mvc.Testing"})," \u5fae\u8f6f\u63d0\u4f9b\u7684\u96c6\u6210\u6d4b\u8bd5\u62d3\u5c55"]}),"\n"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/ut13.png")}),"\n",(0,s.jsxs)(n.ol,{start:"3",children:["\n",(0,s.jsx)(n.li,{children:"\u5404\u79cd\u521b\u5efa\u4e3b\u673a\u65b9\u5f0f\u793a\u4f8b"}),"\n"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {15,33}",children:'using Microsoft.AspNetCore.Builder;\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing Microsoft.Extensions.Hosting;\r\nusing Xunit;\r\n\r\nnamespace TestProject3;\r\n\r\npublic class UnitTest1\r\n{\r\n /// \r\n /// \u521b\u5efa\u4e3b\u673a\u5e76\u6ce8\u518c\u670d\u52a1\r\n /// \r\n /// \u53ef\u7528\u6765\u5224\u65ad\u670d\u52a1\u662f\u5426\u6ce8\u518c\r\n [Fact]\r\n public void Test1()\r\n {\r\n var builder = WebApplication.CreateBuilder();\r\n\r\n // \u6ce8\u518c\u670d\u52a1\r\n builder.Services.AddScoped();\r\n\r\n using var app = builder.Build();\r\n var services = app.Services;\r\n\r\n services.GetRequiredService();\r\n }\r\n\r\n /// \r\n /// \u6d4b\u8bd5\u914d\u7f6e\r\n /// \r\n /// \u6bd4\u5982\u6dfb\u52a0 JSON \u6587\u4ef6\u914d\u7f6e\u540e\u8bfb\u53d6\r\n [Fact]\r\n public void Test2()\r\n {\r\n var builder = WebApplication.CreateBuilder();\r\n var host = builder.Host;\r\n host.ConfigureAppConfiguration(builder =>\r\n {\r\n builder.Sources.Clear();\r\n });\r\n\r\n var config = builder.Configuration["\u914d\u7f6e"];\r\n\r\n // \u5224\u65ad\u4e0d\u4e3a\u7a7a\r\n }\r\n}\n'})}),"\n",(0,s.jsx)(n.h3,{id:"36193-\u7cfb\u7edf\u96c6\u6210\u73af\u5883\u914d\u7f6e\u90e8\u7f72\u6d4b\u8bd5",children:"36.1.9.3 \u7cfb\u7edf\u96c6\u6210/\u73af\u5883/\u914d\u7f6e\u90e8\u7f72\u6d4b\u8bd5"}),"\n",(0,s.jsxs)(n.p,{children:["\u6709\u65f6\u5019\u6211\u4eec\u9700\u8981\u6d4b\u8bd5 ",(0,s.jsx)(n.code,{children:"Web"})," \u4e3b\u673a\u5404\u79cd\u60c5\u51b5\uff0c\u6bd4\u5982\u7aef\u53e3\u662f\u5426\u6709\u6548\uff0c\u73af\u5883\u914d\u7f6e\u662f\u5426\u6709\u6548\uff0c\u7cfb\u7edf\u96c6\u6210\u60c5\u51b5\u7b49\u7b49\uff0c\u8fd9\u65f6\u5019\u53ea\u9700\u8981\u6dfb\u52a0 ",(0,s.jsx)(n.code,{children:"Microsoft.AspNetCore.TestHost"})," \u62d3\u5c55\uff0c\u7136\u540e\u5728\u6d4b\u8bd5\u7c7b\u9876\u90e8\u8d34\uff1a"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"[assembly: HostingStartup(typeof(WebApplicationTests.TestHostingStartup))]\n"})}),"\n",(0,s.jsxs)(n.p,{children:["\u5fae\u8f6f\u5df2\u7ecf\u63d0\u4f9b\u4e86\u975e\u5e38\u8be6\u7ec6\u7684\u4f8b\u5b50\uff0c\u8fd9\u91cc\u76f4\u63a5\u653e\u94fe\u63a5 ",(0,s.jsx)(n.a,{href:"https://github.com/dotnet/aspnetcore/tree/main/src/DefaultBuilder/test/Microsoft.AspNetCore.Tests",children:"https://github.com/dotnet/aspnetcore/tree/main/src/DefaultBuilder/test/Microsoft.AspNetCore.Tests"})]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"WebApplicationTests.TestHostingStartup"})," \u4e3a\u60a8\u8981\u6d4b\u8bd5\u7684 ",(0,s.jsx)(n.code,{children:"Web"})," \u9879\u76ee\u542f\u52a8\u7c7b\u3002"]}),"\n",(0,s.jsxs)(n.h3,{id:"36194-\u96c6\u6210-furionxunit-\u62d3\u5c55",children:["36.1.9.4 \u96c6\u6210 ",(0,s.jsx)(n.code,{children:"Furion.Xunit"})," \u62d3\u5c55"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"Web"})," \u96c6\u6210\u6d4b\u8bd5\u652f\u6301\u5b8c\u6574\u7684 ",(0,s.jsx)(n.code,{children:"Furion"})," \u7279\u6027\uff0c\u53c2\u8003\u4e0a\u9762\u5355\u5143\u6d4b\u8bd5\u96c6\u6210 ",(0,s.jsx)(n.code,{children:"Furion"})," \u7ae0\u8282\u3002"]}),"\n",(0,s.jsxs)(n.admonition,{type:"note",children:[(0,s.jsxs)(n.mdxAdmonitionTitle,{children:[(0,s.jsx)(n.code,{children:"Furion"})," \u7eaf\u51c0\u7248"]}),(0,s.jsxs)(n.p,{children:["\u5982\u679c\u4f7f\u7528\u7684\u662f ",(0,s.jsx)(n.code,{children:"Furion.Pure"})," \u5219\u5b89\u88c5 ",(0,s.jsx)(n.code,{children:"Furion.Pure.Xunit"})," \u8fd9\u4e2a\u62d3\u5c55\u5305\u3002"]})]}),"\n",(0,s.jsxs)(n.h2,{id:"36110-assert-\u65ad\u8a00",children:["36.1.10 ",(0,s.jsx)(n.code,{children:"Assert"})," \u65ad\u8a00"]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"Assert"})," \u662f\u5355\u5143\u6d4b\u8bd5\u5224\u5b9a\u6210\u529f\u7684\u4f9d\u636e\uff0c\u901a\u5e38\u7b2c\u4e00\u4e2a\u53c2\u6570\u4e3a ",(0,s.jsx)(n.code,{children:"\u671f\u671b\u503c"}),"\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3a ",(0,s.jsx)(n.code,{children:"\u5b9e\u9645\u503c"}),"\uff0c\u5bf9\u6bd4\u8fd9\u4e24\u4e2a\u503c\u662f\u5426\u4e00\u81f4\u5373\u53ef\u5224\u65ad\u6210\u529f\u4e0e\u5426\u3002\u8be6\u7ec6\u7684 ",(0,s.jsx)(n.code,{children:"Assert"})," \u9759\u6001\u65b9\u6cd5\u53ef\u67e5\u9605\u5b98\u65b9\u5e93 ",(0,s.jsx)(n.a,{href:"https://github.com/xunit/assert.xunit",children:"Assert \u65b9\u6cd5"})]}),"\n",(0,s.jsx)(n.h2,{id:"36111-\u5355\u5143\u6d4b\u8bd5\u8986\u76d6\u7387",children:"36.1.11 \u5355\u5143\u6d4b\u8bd5\u8986\u76d6\u7387"}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"Visual Studio"})," \u63d0\u4f9b\u4e86\u5206\u6790\u5355\u5143\u6d4b\u8bd5\u8986\u76d6\u7387\u5de5\u5177\uff0c\u5982\uff1a"]}),"\n",(0,s.jsx)("img",{src:(0,l.Z)("img/fgl.png")}),"\n",(0,s.jsx)(n.h2,{id:"36112-\u53cd\u9988\u4e0e\u5efa\u8bae",children:"36.1.12 \u53cd\u9988\u4e0e\u5efa\u8bae"}),"\n",(0,s.jsx)(n.admonition,{title:"\u4e0e\u6211\u4eec\u4ea4\u6d41",type:"note",children:(0,s.jsxs)(n.p,{children:["\u7ed9 Furion \u63d0 ",(0,s.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/new?issue",children:"Issue"}),"\u3002"]})}),"\n",(0,s.jsx)(n.hr,{}),"\n",(0,s.jsx)(n.admonition,{title:"\u4e86\u89e3\u66f4\u591a",type:"note",children:(0,s.jsxs)(n.p,{children:["\u60f3\u4e86\u89e3\u66f4\u591a ",(0,s.jsx)(n.code,{children:"\u5355\u5143\u6d4b\u8bd5"})," \u77e5\u8bc6\u53ef\u67e5\u9605 ",(0,s.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/dotnet/core/testing/",children:"\u5728 .NET \u4e2d\u6d4b\u8bd5"})," \u7ae0\u8282\u3002"]})})]})}function h(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(x,{...e})}):x(e)}},510:(e,n,r)=>{r.d(n,{Z:()=>B});r(7294);const s=(e,n,r)=>e?"string"==typeof e?e:e[n]||r:r;var i=r(5893);const c={display:"block"},l=e=>{let{size:n,color:r,style:l,...t}=e;const o=l?{...c,...l}:c;return(0,i.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:o,...t,children:(0,i.jsx)("path",{d:"M856.4 292.8c-63.3-63.6-126.6-127.1-190.2-190.3-15.3-15.2-32.7-16.1-48.1-0.8-64.3 63.6-128.1 127.6-191.8 191.9-14 14.2-16.3 31.6-1.7 46 14.8 14.7 31.5 10.6 46.1-2.7 5.1-4.6 9.8-9.7 14.7-14.7 39.2-39.7 78.5-79.5 122.8-124.4 0 170 3 332.2-1.1 494-2.4 96.4-91.2 174.6-187.4 176.6-110.6 2.3-198.6-84.4-199-197.4-0.6-136.3-0.2-272.6-0.1-408.9 0-21.8-7.9-37.4-31.2-39.9-18.9-2-33.2 13.2-33.1 37.5 0 145.8-3.4 291.7 2.4 437.2 6 152.1 160.4 263.5 309.5 230.5C591.8 900 672.8 797.2 673.6 664.6c0.8-144 0.2-288.1 0.2-432.1v-33.3c11.2 10.2 17.6 15.4 23.3 21.3 38.5 38.4 76.7 77 115.3 115.2 14.8 14.6 32.2 19.2 47.8 2.9 13.8-14.8 10.3-31.7-3.8-45.8z",fill:s(r,0,"#333333")})})};l.defaultProps={size:18};const t=l,o={display:"block"},d=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...o,...c}:o;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M143.872 768a51.2 51.2 0 0 1-15.36-2.56 51.2 51.2 0 0 1-35.328-51.2V283.136a148.992 148.992 0 0 1 141.824-153.6h450.56a148.992 148.992 0 0 1 141.824 153.6V512a148.992 148.992 0 0 1-141.824 153.6H244.224l-60.928 80.896a51.2 51.2 0 0 1-39.424 21.504zM235.008 180.224a97.792 97.792 0 0 0-90.624 102.4v430.592L218.624 614.4h466.944a97.792 97.792 0 0 0 90.624-102.4V283.136a97.792 97.792 0 0 0-90.624-102.4z",fill:s(r,0,"#333333")}),(0,i.jsx)("path",{d:"M880.128 875.52a51.2 51.2 0 0 1-39.424-20.48l-60.928-80.896h-243.2a25.6 25.6 0 0 1 0-51.2h268.8l76.288 102.4v-295.936a25.6 25.6 0 0 1 25.6-25.6 25.6 25.6 0 0 1 25.6 25.6v293.888a51.2 51.2 0 0 1-51.2 51.2z",fill:s(r,1,"#333333")})]})};d.defaultProps={size:18};const a=d,u={display:"block"},x=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...u,...c}:u;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M223.425605 449.2744l161.632237 0 0 253.65714c0 16.954137 13.745049 30.699186 30.699186 30.699186 16.95516 0 30.699186-13.745049 30.699186-30.699186l0-284.356326c0-16.95516-13.744026-30.699186-30.699186-30.699186L291.035446 387.876028l217.23665-248.51605L733.039255 387.580293 607.104031 387.580293c-16.954137 0-30.699186 13.745049-30.699186 30.699186l0 284.652062c0 16.954137 13.745049 30.699186 30.699186 30.699186s30.699186-13.745049 30.699186-30.699186L637.803217 448.978664l164.448376 0c12.140505 0 23.140023-7.154957 28.063149-18.251689 4.922103-11.097756 2.841721-24.053835-5.307889-33.05279L530.62315 72.570829c-5.881964-6.495948-14.273075-10.134825-23.024389-10.091846-8.763594 0.076748-17.076934 3.895727-22.844288 10.494005L200.312188 398.371056c-7.92653 9.067516-9.818623 21.931498-4.839215 32.896224S211.383338 449.2744 223.425605 449.2744z",fill:s(r,0,"#333333")}),(0,i.jsx)("path",{d:"M222.354204 829.113381l581.732178 0c16.954137 0 30.699186-13.745049 30.699186-30.699186s-13.745049-30.699186-30.699186-30.699186L222.354204 767.715009c-16.954137 0-30.699186 13.745049-30.699186 30.699186S205.400067 829.113381 222.354204 829.113381z",fill:s(r,1,"#333333")}),(0,i.jsx)("path",{d:"M804.086381 896.729361 222.354204 896.729361c-16.954137 0-30.699186 13.745049-30.699186 30.699186s13.745049 30.699186 30.699186 30.699186l581.732178 0c16.954137 0 30.699186-13.745049 30.699186-30.699186S821.041542 896.729361 804.086381 896.729361z",fill:s(r,2,"#333333")})]})};x.defaultProps={size:18};const h=x,j={display:"block"},p=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...j,...c}:j;return(0,i.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:(0,i.jsx)("path",{d:"M380.15463648 874.54223633c0 18.12744166-14.83154297 32.95898463-32.95898463 32.95898463s-32.95898463-14.83154297-32.95898462-32.95898463V228.9152832L172.71078883 370.86962865a33.04467773 33.04467773 0 0 1-46.60400416 0 33.04467773 33.04467773 0 0 1 0-46.6040034l197.55615234-198.14941406A32.76782227 32.76782227 0 0 1 347.0967749 116.52514674c0.03295924 0 0.06591772-0.03295924 0.09887695-0.03295924 1.54907201 0 2.90039088 0.69213867 4.41650366 0.88989258 2.66967773 0.39550781 5.40527318 0.59326172 7.94311548 1.61499049 12.03002904 4.94384766 20.59936549 16.71020508 20.59936549 30.45410156v725.0910642z m320.15698192 23.34155248a32.85351537 32.85351537 0 0 1-23.43383789 9.59106445c-0.03295924 0-0.06591772 0.03295924-0.09887696 0.03295924-1.54907201 0-2.90039088-0.69213867-4.41650365-0.92285182-2.70263697-0.36254857-5.40527318-0.56030248-7.94311549-1.61498972-12.03002904-4.91088842-20.59936549-16.67724584-20.59936473-30.42114309V149.45776367c0-18.12744166 14.83154297-32.95898463 32.95898387-32.95898463s32.95898463 14.83154297 32.95898463 32.95898463v645.60058619l141.52587916-141.92138697c12.81445313-12.82104467 33.81591797-12.82104467 46.63037109 0 12.78808619 12.81445313 12.78808619 33.77636719 0 46.60400416L700.3116184 897.88378881z",fill:s(r,0,"#333333")})})};p.defaultProps={size:18};const g=p,m={display:"block"},v=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...m,...c}:m;return(0,i.jsx)("svg",{viewBox:"0 0 1172 1024",width:n+"px",height:n+"px",style:t,...l,children:(0,i.jsx)("path",{d:"M870.0416 250.4704a38.4 38.4 0 0 0-8.96 53.5552c13.056 18.2784 24.4224 37.8368 33.7408 58.112a38.4512 38.4512 0 0 0 50.944 18.8928 38.4512 38.4512 0 0 0 18.8416-50.944 436.0192 436.0192 0 0 0-40.96-70.6048 38.3488 38.3488 0 0 0-53.6064-9.0112zM181.4528 566.016a35.9936 35.9936 0 0 0 25.5488-10.5984L351.7952 410.624a36.096 36.096 0 1 0-51.0976-51.0976L217.6 442.5728C250.0096 278.1184 395.264 153.6 569.1392 153.6c50.7904 0 99.8912 10.3936 145.92 30.9248a38.4 38.4 0 1 0 31.232-70.0928 431.36 431.36 0 0 0-177.152-37.632c-214.6816 0-393.1136 156.416-428.4416 361.216L62.1568 359.4752a36.1984 36.1984 0 0 0-51.0976 51.0976l144.8448 144.7936a36.0448 36.0448 0 0 0 25.5488 10.6496zM978.5344 463.104a36.1984 36.1984 0 0 0-51.0976 0l-144.8448 144.7936a36.096 36.096 0 1 0 51.0976 51.0976l88.6272-88.576C894.3104 740.2496 746.8032 870.4 569.1392 870.4a357.7856 357.7856 0 0 1-325.2736-207.7184 38.4 38.4 0 1 0-69.7344 32.3072 434.3808 434.3808 0 0 0 394.9568 252.2112c215.1936 0 393.984-157.184 428.6464-362.7008l74.496 74.496a35.9936 35.9936 0 0 0 51.0976 0 36.096 36.096 0 0 0 0-51.0976l-144.7936-144.7936z",fill:s(r,0,"#333333")})})};v.defaultProps={size:18};const b=v,y={display:"block"},F=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...y,...c}:y;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M302 332a30 30 0 1 1 0-60h420a30 30 0 0 1 0 60H302zM302 542a30 30 0 0 1 0-60h420a30 30 0 0 1 0 60H302zM302 752a30 30 0 0 1 0-60h120a30 30 0 0 1 0 60H302z",fill:s(r,0,"#333333")}),(0,i.jsx)("path",{d:"M789.47 784.1a30 30 0 0 1 39.36 45.3l-144.24 125.25a30 30 0 0 1-19.68 7.35H214.85C163.4 962 122 919.46 122 867.38V156.62C122 104.54 163.4 62 214.85 62h594.3C860.6 62 902 104.54 902 156.62v529.05a30 30 0 1 1-60 0V156.62C842 137.3 827.09 122 809.15 122H214.85C196.91 122 182 137.3 182 156.62v710.76C182 886.7 196.91 902 214.85 902h438.84l135.78-117.9z",fill:s(r,1,"#333333")}),(0,i.jsx)("path",{d:"M692 931.19a30 30 0 1 1-60 0v-174.6C632 704.57 673.4 662 724.85 662h147.78a30 30 0 0 1 0 60h-147.78c-17.94 0-32.85 15.3-32.85 34.62v174.6z",fill:s(r,2,"#333333")})]})};F.defaultProps={size:18};const C=F,f={display:"block"},S=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...f,...c}:f;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M512 883.2A371.2 371.2 0 1 0 140.8 512 371.2 371.2 0 0 0 512 883.2z m0 64a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z",fill:s(r,0,"#333333")}),(0,i.jsx)("path",{d:"M557.056 512l122.368 122.368a31.744 31.744 0 1 1-45.056 45.056L512 557.056l-122.368 122.368a31.744 31.744 0 1 1-45.056-45.056L466.944 512 344.576 389.632a31.744 31.744 0 1 1 45.056-45.056L512 466.944l122.368-122.368a31.744 31.744 0 1 1 45.056 45.056z",fill:s(r,1,"#333333")})]})};S.defaultProps={size:18};const T=S,A={display:"block"},M=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...A,...c}:A;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M940 512H792V412c76.8 0 139-62.2 139-139 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 34.8-28.2 63-63 63H232c-34.8 0-63-28.2-63-63 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 76.8 62.2 139 139 139v100H84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h148v96c0 6.5 0.2 13 0.7 19.3C164.1 728.6 116 796.7 116 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-44.2 23.9-82.9 59.6-103.7 6 17.2 13.6 33.6 22.7 49 24.3 41.5 59 76.2 100.5 100.5S460.5 960 512 960s99.8-13.9 141.3-38.2c41.5-24.3 76.2-59 100.5-100.5 9.1-15.5 16.7-31.9 22.7-49C812.1 793.1 836 831.8 836 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-79.3-48.1-147.4-116.7-176.7 0.4-6.4 0.7-12.8 0.7-19.3v-96h148c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM716 680c0 36.8-9.7 72-27.8 102.9-17.7 30.3-43 55.6-73.3 73.3-20.1 11.8-42 20-64.9 24.3V484c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v396.5c-22.9-4.3-44.8-12.5-64.9-24.3-30.3-17.7-55.6-43-73.3-73.3C317.7 752 308 716.8 308 680V412h408v268z",fill:s(r,0,"#333333")}),(0,i.jsx)("path",{d:"M304 280h56c4.4 0 8-3.6 8-8 0-28.3 5.9-53.2 17.1-73.5 10.6-19.4 26-34.8 45.4-45.4C450.9 142 475.7 136 504 136h16c28.3 0 53.2 5.9 73.5 17.1 19.4 10.6 34.8 26 45.4 45.4C650 218.9 656 243.7 656 272c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-40-8.8-76.7-25.9-108.1-17.2-31.5-42.5-56.8-74-74C596.7 72.8 560 64 520 64h-16c-40 0-76.7 8.8-108.1 25.9-31.5 17.2-56.8 42.5-74 74C304.8 195.3 296 232 296 272c0 4.4 3.6 8 8 8z",fill:s(r,1,"#333333")})]})};M.defaultProps={size:18};const N=M,w={display:"block"},I=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...w,...c}:w;return(0,i.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:[(0,i.jsx)("path",{d:"M512 71.68c-242.688 0-440.32 197.632-440.32 440.32s197.632 440.32 440.32 440.32 440.32-197.632 440.32-440.32-197.632-440.32-440.32-440.32z m0 819.2c-208.896 0-378.88-169.984-378.88-378.88s169.984-378.88 378.88-378.88 378.88 169.984 378.88 378.88-169.984 378.88-378.88 378.88z",fill:s(r,0,"#333333")}),(0,i.jsx)("path",{d:"M542.72 261.12H481.28v220.16H261.12v61.44h220.16v220.16h61.44v-220.16h220.16V481.28h-220.16z",fill:s(r,1,"#333333")})]})};I.defaultProps={size:18};const P=I,z={display:"block"},k=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...z,...c}:z;return(0,i.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:(0,i.jsx)("path",{d:"M384 896h-64v-70.4c0-15.2-10.4-28-24.8-31.2C159.2 768 64 644.8 64 496v-32h64v32c0 118.4 73.6 215.2 179.2 236 44.8 8.8 76.8 48 76.8 94.4v69.6zM704 896h-64v-70.4c0-45.6 32-85.6 76.8-94.4C822.4 711.2 896 614.4 896 496v-32h64v32c0 148.8-95.2 272-231.2 298.4-14.4 3.2-24.8 16-24.8 31.2v70.4zM512.8 640l-41.6-37.6c-147.2-133.6-244-208-244-316.8 0-88 68.8-156.8 156.8-156.8 49.6 0 97.6 23.2 128.8 60C544 152 592 128.8 641.6 128.8c88 0 156.8 68.8 156.8 156.8 0 108-96.8 183.2-244 316.8L512.8 640z",fill:s(r,0,"#333333")})})};k.defaultProps={size:18};const L=k,E={display:"block"},_=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...E,...c}:E;return(0,i.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:(0,i.jsx)("path",{d:"M942.4615936 284.62787926c-14.30911886-14.12709945-37.31996786-14.05468217-51.48229632 0.21920654L517.97142983 661.27810333 139.75544149 286.45003606c-14.30911886-14.16232846-37.31996786-14.05468217-51.51948344 0.21920654-14.16232846 14.30911886-14.05468217 37.35519687 0.21920654 51.51948345l401.99014627 398.34974663c0.61847666 0.61847666 1.41897273 0.76526706 2.03940637 1.34655658 0.14483342 0.14483342 0.18201941 0.32685283 0.32685283 0.47364324 7.09877874 7.02636259 16.38375538 10.55911595 25.63154489 10.55911595 9.35739278 0 18.75001458-3.60516949 25.85075143-10.77636551l398.34974663-401.99014628C956.84312974 321.8382427 956.73548345 298.7921647 942.4615936 284.62787926z",fill:s(r,0,"#333333")})})};_.defaultProps={size:18};const W=_,X={display:"block"},U=e=>{let{size:n,color:r,style:c,...l}=e;const t=c?{...X,...c}:X;return(0,i.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...l,children:(0,i.jsx)("path",{d:"M81.5384064 739.37212074c14.30911886 14.12709945 37.31996786 14.05468217 51.48229632-0.21920654L506.02857017 362.72189667 884.24455851 737.54996394c14.30911886 14.16232846 37.31996786 14.05468217 51.51948344-0.21920654 14.16232846-14.30911886 14.05468217-37.35519687-0.21920654-51.51948345l-401.99014627-398.34974663c-0.61847666-0.61847666-1.41897273-0.76526706-2.03940637-1.34655658-0.14483342-0.14483342-0.18201941-0.32685283-0.32685282-0.47364324-7.09877874-7.02636259-16.38375538-10.55911595-25.6315449-10.55911595-9.35739278 0-18.75001458 3.60516949-25.85075143 10.77636551l-398.34974663 401.99014628C67.15687026 702.1617573 67.26451655 725.2078353 81.5384064 739.37212074z",fill:s(r,0,"#333333")})})};U.defaultProps={size:18};const D=U,H=e=>{let{name:n,...r}=e;switch(n){case"youhua":return(0,i.jsx)(t,{...r});case"dayi":return(0,i.jsx)(a,{...r});case"shengji":return(0,i.jsx)(h,{...r});case"tiaozheng":return(0,i.jsx)(g,{...r});case"gengxin":return(0,i.jsx)(b,{...r});case"wendang":return(0,i.jsx)(C,{...r});case"shanchu":return(0,i.jsx)(T,{...r});case"bug":return(0,i.jsx)(N,{...r});case"xinzeng":return(0,i.jsx)(P,{...r});case"fuwu":return(0,i.jsx)(L,{...r});case"down":return(0,i.jsx)(W,{...r});case"up":return(0,i.jsx)(D,{...r})}return null},Z={label:"label_p8vM",icon:"icon_knQK"};function B(e){const{children:n}=e,r={"\u65b0\u589e":{icon:"xinzeng",bgColor:"#39b54a"},"\u4fee\u590d":{icon:"bug",bgColor:"#9c26b0"},"\u6587\u6863":{icon:"wendang",bgColor:"rgb(79, 147, 255)"},"\u66f4\u65b0":{icon:"gengxin",bgColor:"#0081ff"},"\u8c03\u6574":{icon:"tiaozheng",bgColor:"#333"},"\u5347\u7ea7":{icon:"shengji",bgColor:"#e03997"},"\u79fb\u9664":{icon:"shanchu",bgColor:"#666"},"\u7b54\u7591":{icon:"dayi",bgColor:"#bbb"},"\u4f18\u5316":{icon:"youhua",bgColor:"#38e550"}};return(0,i.jsxs)("label",{className:Z.label,title:n,style:{backgroundColor:r[n].bgColor},children:[(0,i.jsx)(H,{name:r[n].icon,color:"white",size:14,className:Z.icon})," ",n]})}},1151:(e,n,r)=>{r.d(n,{Z:()=>t,a:()=>l});var s=r(7294);const i={},c=s.createContext(i);function l(e){const n=s.useContext(c);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function t(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),s.createElement(c.Provider,{value:n},e.children)}}}]);