You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we use two or more Command object, UnExecute method work incorrect. For example when we add text, number and text and we want to undo last change for numberCommand we remove string (which have length of added number) from global StringBuilder object
Look at this code
var text1 = "abc";
var text2 = "defgh";
var numb1 = "1234";
var controller = new Controller();
var addNumbCommandReference = controller.AddCommand(new AddNumbersCommand());
var addTextCommandReference = controller.AddCommand(new AddTextCommand());
controller.GetCommandAt(addTextCommandReference).Execute(text1);
controller.GetCommandAt(addNumbCommandReference).Execute(numb1);
controller.GetCommandAt(addTextCommandReference).Execute(text2);
controller.GetCommandAt(addNumbCommandReference).UnExecute();
//Output
//abc1234d
//Expected:
//abcdefgh
The text was updated successfully, but these errors were encountered:
https://github.com/skimedic/presentations/tree/master/Patterns/BehavioralPatterns/Command/AddNumbersCommand.cs and AddTextCommand.cs
When we use two or more Command object, UnExecute method work incorrect. For example when we add text, number and text and we want to undo last change for numberCommand we remove string (which have length of added number) from global StringBuilder object
Look at this code
The text was updated successfully, but these errors were encountered: