CellsAutomate.Mutator.Mutations.ReplaceCommandMutation.Undo C# (CSharp) Method

Undo() public method

public Undo ( ) : void
return void
        public void Undo()
        {
            _replaced?.Undo();
            _replaced = null;
        }

Usage Example

        public void ReplaceUndo()
        {
            const string code = @"int ione
                                  ione = 5
                                  int itwo
                                  itwo = 2
                                  int ithree
                                  ithree = ione
                                  ";
            var commands = GenerateCommands(code);
            var mutation = new ReplaceCommandMutation(new Random(), commands);

            mutation.Transform();
            mutation.Undo();

            var assertCommands = GenerateCommands(code);
            Assert.IsTrue(AreCollectionsEquals(commands, assertCommands));
        }