How can I Unit Test PlayMode behaviours with a Scriptable Object Channel based setup for my Unity game?

60 Views Asked by At

I'm writing a card game in Unity and have a setup where all my MonoBehaviour objects communicate through SO channels. For example,

GraphicsEngine <= GameManager <=> AI

I would like to write some PlayMode unit tests that, for example, set all of the players to AI and run through a deal.

I want to do something like the following:

    public class MyTest 
    { 
        [UnityTest] 
        public IEnumerator RunThroughWithAllPlayersAI() 
        { 
            GameManager gameManager = "Some kind of mock GameManager but with Channels correctly loaded"; 
            gameManager.NSAreAI = true; 
            gameManager.waitAfterTrick = false; 
            gameManager.fixRandomSeed = false; 
            gameManager.DealCards(); 
            yield return new WaitForSeconds(1f); 
            Assert.True(true); 
        } 
} 

I'm not sure I can do this with interfaces because I don't think the SO Channels will be correctly loaded.

0

There are 0 best solutions below