Example #1
0
        public void WaitForCoroutineMethod_ContainsCorrectDescription()
        {
            var instruction = Responsibly
                              .WaitForCoroutineMethod(this.ThrowImmediately)
                              .ExpectWithinSeconds(1)
                              .ToYieldInstruction(this.Executor);

            Assert.IsTrue(instruction.CompletedWithError);
            StringAssert.Contains("ThrowImmediately (Coroutine)", instruction.Error.Message);
        }
Example #2
0
        public void WaitForCoroutine_ThrowsWithInvalidExecutor()
        {
            var nonUnityExecutor = new TestInstructionExecutor(new MockTestScheduler());
            var instruction      = Responsibly
                                   .WaitForCoroutineMethod(this.Forever)
                                   .ExpectWithinSeconds(1)
                                   .ToYieldInstruction(nonUnityExecutor);

            Assert.IsTrue(instruction.CompletedWithError);
            StringAssert.Contains(nameof(MonoBehaviour), instruction.Error.Message);
        }
Example #3
0
        public IEnumerator CompoundCoroutineWait_ContainsCorrectDescription()
        {
            var instruction = Responsibly
                              .WaitForCoroutineMethod(this.CompleteAfterOneFrame)
                              .AndThen(Responsibly.WaitForCoroutineMethod(this.ThrowImmediately))
                              .ExpectWithinSeconds(1)
                              .ToYieldInstruction(this.Executor, throwOnError: false);

            yield return(instruction);

            Assert.IsTrue(instruction.CompletedWithError);
            Assert.That(
                instruction.Error.Message,
                Does.Match(@"\[✓\] CompleteAfterOneFrame.*\n.*\[!\] ThrowImmediately"));
        }