public void Setup() { snowmanMoveComponent = Substitute.For<ISnowmanMoveComponent>(); snowmanFactory = Substitute.For<ISnowmanFactory>(); snowmanController = new SnowmanController(snowmanFactory, snowmanMoveComponent); }
public void Setup() { prefabTemplate = new GameObject("Snowman"); unityResources = Substitute.For<IUnityResources>(); snowmanPoolManager = Substitute.For<ISnowmanPoolManager>(); snowmanMoveComponent = Substitute.For<ISnowmanMoveComponent>(); unityResources.Load(SnowmanController.SNOWMAN_ASSET_PATH, typeof(GameObject)).Returns(prefabTemplate); unityResources.Instantiate(prefabTemplate).Returns(prefabTemplate); snowmanController = new SnowmanController(snowmanPoolManager, unityResources); snowmanController.Initialize(); var prop = snowmanController.GetType().GetField("moveComponent", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); prop.SetValue(snowmanController, snowmanMoveComponent); }