我有一个 Visual Studio 2012 项目并安装了以下 NuGet 包:
- 使用最小起订量进行自动模拟的 AutoFixture
- Autofixture 与 xUnit.net 数据理论
- 汽车夹具
- Moq
- xUnit.net:扩展
- xUnit.net:跑步者
- xUnit.net
给出以下设计的 Logger 类 (Logger.fs):
namespace FUnit
type public ILoggerContext =
abstract member LogPath :string
type public LoggerContext (logPath :string) =
member val LogPath = logPath with get, set
interface ILoggerContext with
member this.LogPath = this.LogPath
type public Logger () =
member this.Log (context: ILoggerContext) value =
System.String.Format("Logged {0} to {1}.", value, context.LogPath)
以及以下单元测试:
namespace FUnit.Test
open FUnit
type public Math_Add() =
[<Xunit.Extensions.Theory>]
[<Ploeh.AutoFixture.Xunit.AutoData>]
member this.``Should Output Value And Path`` (path :string) =
let context = new LoggerContext(path)
let logger = new Logger()
let expected = System.String.Format("Logged value to {0}.", path)
let actual = logger.Log context "value"
Xunit.Assert.Equal<string>(expected, actual)
确保我显示所有测试并构建项目后,测试资源管理器无法识别单元测试。项目正确构建,构建、常规或测试输出日志中没有错误或警告。
如果我用 Fact 属性替换当前的 Theory 和 AutoData 属性,则会显示测试。
F# 测试项目是否支持 AutoFixture?
其他人可以复制这个并知道我做错了什么吗?