Ejemplo n.º 1
0
        public void Test_No_Handler()
        {
            var commands = new List <DecoratedCommand <Log, StringBuilder> >();

            commands.Add(new DecoratedAdd((_) => new StringBuilder("Add")));
            commands.Add(new DecoratedUpdate((_) => new StringBuilder("Update")));
            commands.Add(new DecoratedDelete((_) => new StringBuilder("Delete")));

            var pushAction = new PushChain(commands);

            Log log = new Log()
            {
                Action = "Upsert"
            };

            Assert.IsNull(pushAction.Handle(log));
        }
Ejemplo n.º 2
0
        public void Test_Delete_Handled()
        {
            var commands = new List <DecoratedCommand <Log, StringBuilder> >();

            commands.Add(new DecoratedAdd((_) => new StringBuilder("Add")));
            commands.Add(new DecoratedUpdate((_) => new StringBuilder("Update")));
            commands.Add(new DecoratedDelete((_) => new StringBuilder("Delete")));

            var pushAction = new PushChain(commands);

            Log log = new Log()
            {
                Action = "Delete"
            };

            Assert.IsTrue(pushAction.Handle(log).ToString().Equals("Delete"));
        }