CellsAutomate.Mutator.Mutations.SwapCommandMutation.Transform C# (CSharp) Method

Transform() public method

public Transform ( ) : void
return void
        public void Transform()
        {
            InitNextTransform();
            var firstIndex = _random.Next(_commands.Count);
            var secondIndex = _random.Next(_commands.Count);
            var command = new SwapCommand(_commands, firstIndex, secondIndex);
            command.Execute();
            _swapped=command;
        }

Usage Example

Ejemplo n.º 1
0
        public void SwapUndo()
        {
            const string code = @"int ione
                                  ione = 5
                                  int itwo
                                  itwo = 2
                                  int three
                                  int four
                                  int five";
            var commands = GenerateCommands(code);
            var mutation = new SwapCommandMutation(new Random(), commands);

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

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