mardi 21 avril 2020

The name does not exist in the current context after SetUp in unity testing

I'm trying to make unit tests in unity, as I have repeated code, I tried to use SetUp like this

[SetUp]
public void Setup()
{
  PlayerState playerState = (PlayerState)ScriptableObject.CreateInstance("PlayerState");
}

[Test]
public void IsPlayerWinnerTest()
{
  playerState.LastAnswerTime = 6f;
  playerState.IsLastAnswerCorrect = true;
}

So for example, If I have something like this, I get: The name 'playerState' does not exist in the current context. Any idea? Thanks!!

Aucun commentaire:

Enregistrer un commentaire