コード例 #1
0
        public void DoesNotExecuteUnSubmittedCommands()
        {
            var action = new PunchAnimator();

            var dependencyResolver = new LoadableDependencyProvider();

            dependencyResolver.Register <PunchAnimator>(() => action);

            var composer = new ActionComposer(dependencyResolver);

            composer.Route <PunchAnimation, PunchAnimator>();

            var punchAnimation = new PunchAnimation();

            punchAnimation.intensity = 100;

            composer.QueueCommand(punchAnimation);
            composer.ExecuteFrame();

            action._called.Should().Be(0);
            action._payload.Should().NotBe(punchAnimation);
        }
コード例 #2
0
        public void canComposeOneAction()
        {
            var punchAnimator = new PunchAnimator();

            var dependencyResolver = new LoadableDependencyProvider();

            dependencyResolver.Register <PunchAnimator>(() => punchAnimator);

            var composer = new ActionComposer(dependencyResolver);

            composer.Route <PunchAnimation, PunchAnimator>();

            var punchAnimation = new PunchAnimation();

            punchAnimation.intensity = 100;

            composer.QueueCommand(punchAnimation);
            composer.Submit();
            composer.ExecuteFrame();

            punchAnimator._called.Should().Be(1);
            punchAnimator._payload.Should().Be(punchAnimation);
        }