コード例 #1
0
        public void Basic()
        {
            var target   = new Target();
            var provider = new ActionProvider();
            var context  = new Context {
                target
            };
            var system = new ActionSystem {
                new ActionAdd(), new ActionMultiply()
            };

            system.Execute(provider, context);

            Assert.AreEqual(0, target.Value);

            provider.Add(new CommandAdd(2));
            provider.Add(new CommandMultiply(2));
            provider.ApplyQueued();

            system.Execute(provider, context);

            Assert.AreEqual(4, target.Value);
        }