executing "unity test tools" tests both fail and pass + warning

[Test]
public void Blaa()
{
Bla b = Substitute.For();

            Assert.AreEqual(5, b.Get5());
        }

This test passes in the unity editor and fails in VS(executing using ReSharper). Why?

Also as far as I read in the net, Substitute is used for object mocking and I decided to use it in order not to get the

You are trying to create a MonoBehaviour using the ‘new’ keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all

warning. Still I get it, even if I’m not instantiating the object the normal way but with substitute. Why?

Hi @MapuHoB,

VS is using it’s own nUnit runner and therefore some of the Unity code might not work. The reason for that is that the Unity code (like MonoBehaviour) needs to be run in the Editor to work properly.

To answer your second question: NSubstitute is still instantiating the object behind the curtain.

Tomek