title: How to set up unit tests in Unity and fix missing assembly reference error?
body: <p>I created the following structure:</p>
  
  <pre><code>├── Assets
  ├── Scenes
  ├── Scripts
  │   └── MyExample.cs
  ├── Tests
  │   ├── MyExampleTest.cs
  │   └── Tests.asmdef
  </code></pre>
  
  <p>Now, when I click on Run All, in the Test Runner window, in Unity, I have the following error:</p>
  
  <pre><code>The type or namespace name `MyExample' could not be found. Are you missing an assembly reference?
  </code></pre>
  
  <p>In Visual Studio I have two projects:</p>
  
  <ul>
  <li><p>Assembly-CSharp (containing src)</p></li>
  <li><p>Tests (containing Tests)</p></li>
  </ul>
  
  <p>I added Assembly-CSharp as a reference in the second project. Visual Studio is able to build the solution with no errors.</p>
  
  <p>Does anyone know how to properly setup a UnitTest regression for a Unity project?</p>
  
  <p>This is Tests.asmdef</p>
  
  <pre><code>{
      "name": "Tests",
      "optionalUnityReferences": [
          "TestAssemblies"
      ]
  }
  </code></pre>
  
  <p>MyExampleTest.cs</p>
  
  <pre><code>using UnityEngine;
  using UnityEngine.TestTools;
  using NUnit.Framework;
  using System.Collections;
  using abc;
  
  public class MyExampleTest{
  
      [Test]
      public void NewTestScriptSimplePasses() {
          // Use the Assert class to test conditions.
      }
  
      [UnityTest]
      public IEnumerator NewTestScriptWithEnumeratorPasses() {
          abc.Example m;
          Assert.That(false);
          yield return null;
      }
  }
  </code></pre>
  
  <p>MyExample.cs</p>
  
  <pre><code>namespace abc
  {
      public class Example
      {
  
  
      }
  }
  </code></pre>