- Home /
Unit-testing missing reference false-positive?
Trying to create unit tests for a collection of extension methods I'm making, but I get [class] does not contain definition for ...
errors in VS if the assembly assembly is not included through it, and I get The type or namespace name 'XenoRo' could not be found (are you missing a using directive or an assembly reference?)
in the editor when I do include the assembly.
Example:
using NUnit.Framework;
using UnityEngine;
namespace Tests {
public class Vector3ExtensionsTests {
#region Methods
[Test]
public void WithXReturnsCorrectValue() {
var vector = Random.onUnitSphere;
var x = Random.value;
var expected = vector;
expected.x = x;
var result = vector.WithX(x);
Assert.That(result == expected);
}
#endregion
}
}
...Errors on .WithX(x)
and suggests fix by including assembly reference to Assembly-CSharp-firstpass
, but if I tell VS to implemente the fix, it then errors in-editor saying that the namespace could not be found.
What is wrong? And how to fix?
Comment