Example #1
0
        public void IsEditorApplicationCompilingJustFinished_Should_ReturnTrueAndSetTheValueOfIsCompilingPropertyToFalse_Given_TheStateOfIsCompilingPropertyIsTrueAndTheStateOfTheEditorApplicationIsCompilingPropertyIsFalse()
        {
            RunnerEditorBusinessLogicParametersRebuild runnerEditorBusinessLogicParametersRebuild = new RunnerEditorBusinessLogicParametersRebuild();
            RunnerEditorBusinessLogicData runnerBusinessLogicData = new RunnerEditorBusinessLogicData();

            IUnityInterfaceWrapper unityInterfaceWrapper = Substitute.For <IUnityInterfaceWrapper>();

            unityInterfaceWrapper.EditorApplicationIsCompiling().Returns(false);
            runnerBusinessLogicData.IsCompiling = true;
            bool result = runnerEditorBusinessLogicParametersRebuild.IsEditorApplicationCompilingJustFinished(unityInterfaceWrapper, runnerBusinessLogicData);

            Assert.IsTrue(result, "The method IsEditorApplicationCompilingJustFinished doesn't return the right state of editor compilation just finished");
            Assert.IsFalse(runnerBusinessLogicData.IsCompiling, "The method IsEditorApplicationCompilingJustFinished doesn't return the right last state of editor compilation");
        }
        /// <summary>
        /// Determines whether the build process is just finished.
        /// </summary>
        /// <param name="unityInterfaceWrapper">The unity interface wrapper.</param>
        /// <param name="runnerBusinessLogicData">The runner business logic data.</param>
        /// <returns>
        ///   <c>true</c> if the build process is just finished; otherwise, <c>false</c>.
        /// </returns>
        public bool IsEditorApplicationCompilingJustFinished(IUnityInterfaceWrapper unityInterfaceWrapper, RunnerEditorBusinessLogicData runnerBusinessLogicData)
        {
            bool result = false;

            if (!unityInterfaceWrapper.EditorApplicationIsCompiling())
            {
                if (runnerBusinessLogicData.IsCompiling)
                {
                    result = true;
                    runnerBusinessLogicData.IsCompiling = false;
                }
            }
            else
            {
                runnerBusinessLogicData.IsCompiling = true;
                result = false;
            }

            return(result);
        }