简体   繁体   English

如何在F#中运行xunit测试

[英]How can I run xunit test in F#

I have Xunit and Xunit(Runner: Visual Studio) installed and he is my simple test: 我安装了Xunit和Xunit(Runner:Visual Studio),他是我的简单测试:

namespace Testing

    module Tests =
        open Xunit
        open Xunit.Extensions

        [<Fact>]
        let ``just test`` =
                Assert.Equal(1, 1)
                ()

But I can find Xunit in Test -> Window -> Test explorer and Resharper Unit Tests Window. 但是我可以在Test - > Window - > Test explorer和Resharper Unit Tests Window中找到Xunit。

It looks like your test is missing the unit type , () , to identify it as a function taking no arguments. 看起来您的测试缺少单元类型 () ,以将其标识为不带参数的函数。 If you write your test like this it should show up in the Visual Studio Test Explorer. 如果您像这样编写测试,它应该显示在Visual Studio测试资源管理器中。

[<Fact>]
let ``just test`` () =
    Assert.Equal(1, 1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM