Unit Testing Rigidbody2D without polluting scene with gameobjects

I just started using the Unity Unit Test suite, and can’t figure out how to write tests that don’t generate a bunch of a gameobjects. So, what’s the suggested means of working with Unity’s components like Rigidbody2D and MonoBehavior?

I managed to fix my issue by setting up a static GameObject all tests use and a TearDown method. Here’s the code in case any could potentially be helped by it. I’m not sure if this is the most maintainable means of handling this issue, I’m a bit new to Unit testing.

Relevant code pieces:

    private static GameObject gameObject = null;


//...

    private GameObject MakeGamobjectWithRigidBody()
    		{
    			gameObject = new GameObject();
    			gameObject.AddComponent<Rigidbody2D>();
    			return gameObject;
    		}

//...

    [TearDown]
    		public void DestroyGameObjects()
    		{
    			DestroyObject.DestroyImmediate(gameObject);
    		}