I have a Visual Studio 2012 project and the following NuGet packages are installed:
- AutoFixture with Auto Mocking using Moq
- Autofixture with xUnit.net Data Theories
- AutoFixture
- Moq
- xUnit.net: Extensions
- xUnit.net: Runners
- xUnit.net
Given the following contrived Logger class (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)
and unit test:
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)
The tester does not recognize unit test after I demonstrate all the tests and build the project. The project is built correctly, without errors and warnings in the output logs of Build, General or Test.
If you replace the existing Theory and AutoData attributes with the Fact attribute, a test appears.
Is AutoFixture supported in F # test projects? Can anyone else reproduce this and find out what I'm doing wrong?
source share