Пример #1
0
        public void CanCreateCommandAndReplaceItemText()
        {
            var i = new TestReplacable();

            i.Text = "test";
            string str = "sth";
            var    c   = new ReplaceTextCommand(i, str);

            c.Execute();
            Assert.AreEqual(i.Text, str);
        }
Пример #2
0
        public void CanReturnTextBackToPreviousState()
        {
            var    i       = new TestReplacable();
            string oldText = "test";

            i.Text = oldText;
            string str = "sth";
            var    c   = new ReplaceTextCommand(i, str);

            c.Execute();
            Assert.AreEqual(i.Text, str);
            c.Unexecute();
            Assert.AreEqual(i.Text, oldText);
        }