Note that there are some explanatory texts on larger screens.

plurals
  1. POAutoFixture in F# UnitTest Project Not Displaying Unit Tests in Test Explorer
    text
    copied!<p>I have a Visual Studio 2012 Project and the following NuGet Packages installed:</p> <ul> <li>AutoFixture with Auto Mocking using Moq </li> <li>Autofixture with xUnit.net data theories </li> <li>AutoFixture </li> <li>Moq </li> <li>xUnit.net: Extensions </li> <li>xUnit.net: Runners </li> <li>xUnit.net </li> </ul> <p>Given the following contrived Logger class (Logger.fs):</p> <pre><code>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) </code></pre> <p>and the following unit test:</p> <pre><code>namespace FUnit.Test open FUnit type public Math_Add() = [&lt;Xunit.Extensions.Theory&gt;] [&lt;Ploeh.AutoFixture.Xunit.AutoData&gt;] 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&lt;string&gt;(expected, actual) </code></pre> <p>The Test Explorer does not recognize the unit test after ensuring I'm showing all tests and building the project. The project builds correctly with no errors or warnings in the Build, General, or Test output logs.</p> <p>If I replace the current Theory and AutoData attributes with an Fact attribute, the test shows up. </p> <p>Is AutoFixture supported in F# test projects? Can anyone else replicate this and know what I'm doing wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload