AutoFixture in F# UnitTest Project Not Displaying Unit Tests in Test Explorer -


i have visual studio 2012 project , following nuget packages installed:

  • autofixture auto mocking using moq
  • autofixture xunit.net data theories
  • autofixture
  • moq
  • xunit.net: extensions
  • xunit.net: runners
  • xunit.net

given following contrived logger class (logger.fs):

namespace funit  type public iloggercontext =     abstract member logpath :string  type public loggercontext (logpath :string) =     member val logpath = logpath get, set      interface iloggercontext         member this.logpath = this.logpath  type public logger () =     member this.log (context: iloggercontext) value =         system.string.format("logged {0} {1}.", value, context.logpath) 

and following unit test:

namespace funit.test  open funit  type public math_add() =       [<xunit.extensions.theory>]     [<ploeh.autofixture.xunit.autodata>]     member this.``should output value , path`` (path :string) =         let context = new loggercontext(path)         let logger = new logger()          let expected = system.string.format("logged value {0}.", path)         let actual = logger.log context "value"          xunit.assert.equal<string>(expected, actual) 

the test explorer not recognize unit test after ensuring i'm showing tests , building project. project builds correctly no errors or warnings in build, general, or test output logs.

if replace current theory , autodata attributes fact attribute, test shows up.

is autofixture supported in f# test projects? can else replicate , know i'm doing wrong?

i think issue conflicting versions of xunit.extensions used ploeh.autofixture.xunit , test runner.

if run tests using xunit's runners should see exception complaining not being able find specific version of xunit.extensions.

you can fix adding binding redirects test projects app.config. since you're using nuget can have generate binding redirects running in package manager console test project.

add-bindingredirect 

you can tweak generated binding redirects in app.config more specific if want.

once rebuild project should see test appear in vs test explorer.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -