public void NativePlatformInitialize(string gameId, bool testMode, bool loadEnabled) { m_NativePlatformMock.Setup(x => x.Initialize(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <bool>(), It.IsAny <IUnityAdsInitializationListener>())); var platform = new Platform.Platform(m_NativePlatformMock.Object, m_BannerMock.Object, m_CoroutineExecutorMock.Object); platform.Initialize(gameId, testMode, loadEnabled, null); m_NativePlatformMock.Verify(x => x.Initialize(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <bool>(), It.IsAny <IUnityAdsInitializationListener>()), Times.Once(), "NativePlatform.Initialize() was not called as expected"); }
public IEnumerator OnStartCallbackSetsIsShowingOnAdStart(string testPlacementId) { var hasCalledListener = false; var platform = new Platform.Platform(m_NativePlatformMock.Object, m_BannerMock.Object, m_CoroutineExecutorMock.Object); platform.AddListener(new UnityAdsTestListener(null, null, (placementId) => { Assert.That(placementId, Is.EqualTo(testPlacementId), "The placementId under test should have been the placement id that is returned Starting"); hasCalledListener = true; }, null)); platform.Initialize("1234567", false, false, null); platform.UnityAdsDidStart(testPlacementId); while (!hasCalledListener) { yield return(null); } Assert.That(hasCalledListener, Is.True, "The OnUnityAdsDidStart callback should have called"); Assert.That(platform.IsShowing, Is.True, "IsShowing should be set to true after starting to show an ad"); m_CoroutineExecutorMock.Verify(x => x.Post(It.IsAny <Action>()), Times.Once(), "Calls should happen on the main thread and should all batched together as 1 call"); }