Search Unity

Moq and FluentAssertions not referencable in Unity Playmode Test

Discussion in 'Testing & Automation' started by pixel_maniacs, Jul 8, 2021.

  1. pixel_maniacs

    pixel_maniacs

    Joined:
    Jun 25, 2015
    Posts:
    71
    Hi there,
    just tried my very fist Standalone UnityTest build but the compile gives me some headaches.
    I am using the "nuget.moq": "1.0.0" Unity package but this is marked to be compiled/referenced in Editor Platform only.
    How do I get that reference to my Test build?
     
  2. sbergen

    sbergen

    Joined:
    Jan 12, 2015
    Posts:
    53
    Moq is not .NETStandard2.0 compatible, and will also not work on IL2CPP, because it uses dynamic code generation (Castle.Core).

    I'm not sure which registry you are getting it from, but I doubt that the registry maintainer would like to enable it for non-editor platforms, due to the above restrictions. So I think your most viable option would be to just add the .dll manually and set it enabled on the platforms you want. This is, if you are running on the .NET 4.5 profile, and not on IL2CPP.

    Also, I assume you are talking about running tests in player builds (as playmode tests can also be run in the editor).