public void ConditionalRuleToUpdateName()
        {
            var conditionalUpdateValue = new ConditionalIfThActionRule <Game>
            {
                ConditionRule = new MethodCallRule <Game, bool>
                {
                    ObjectToCallMethodOn = "Name",
                    MethodToCall         = "Equals",
                    MethodParameters     =
                    {
                        new ConstantRule <string>           {
                            Value = "some name"
                        },
                        new ConstantRule <StringComparison> {
                            Value = "CurrentCultureIgnoreCase"
                        }
                    }
                },
                TrueRule = new UpdateValueRule <Game>
                {
                    ObjectToUpdate = "Name",
                    SourceDataRule = new ConstantRule <string> {
                        Value = "updated name"
                    }
                }
            };

            var compileResult = conditionalUpdateValue.Compile();

            compileResult.Should().BeTrue();
            _testOutputHelper.WriteLine($"{nameof(conditionalUpdateValue)}:{Environment.NewLine}" +
                                        $"{conditionalUpdateValue.ExpressionDebugView()}");

            var game = new Game {
                Name = "some name"
            };

            _testOutputHelper.WriteLine($"before game.Name: {game.Name}");
            conditionalUpdateValue.Execute(game);
            _testOutputHelper.WriteLine($"after game.Name: {game.Name}");
            game.Name.Should().Be("updated name");
        }
        public void ConditionalRuleLookAtOneValueUpdateAnother()
        {
            var conditionalUpdate = new ConditionalIfThActionRule <Player>
            {
                ConditionRule = new ValidationRule <Player>
                {
                    ObjectToValidate       = "Country.CountryCode",
                    OperatorToUse          = "Equal",
                    ValueToValidateAgainst = new ConstantRule <string> {
                        Value = "ab"
                    }
                },
                TrueRule = new UpdateValueRule <Player>
                {
                    ObjectToUpdate = "CurrentCoOrdinates.X",
                    SourceDataRule = new ConstantRule <int> {
                        Value = "999"
                    }
                }
            };

            var compileResult = conditionalUpdate.Compile();

            compileResult.Should().BeTrue();
            _testOutputHelper.WriteLine($"{nameof(conditionalUpdate)}:{Environment.NewLine}" +
                                        $"{conditionalUpdate.ExpressionDebugView()}");

            var player = new Player
            {
                Country = new Country {
                    CountryCode = "ab"
                },
                CurrentCoOrdinates = new CoOrdinate {
                    X = 1, Y = 1
                }
            };

            conditionalUpdate.Execute(player);
            player.CurrentCoOrdinates.X.Should().Be(999);
            _testOutputHelper.WriteLine($"expected: 999 - actual: {player.CurrentCoOrdinates.X}");
        }
        public void ConditionalRuleWithBlock()
        {
            var nameChangeRule = new UpdateValueRule <Game>
            {
                ObjectToUpdate = "Name",
                SourceDataRule = new ConstantRule <string> {
                    Value = "some fancy name"
                }
            };
            var rankingChangeRule = new UpdateValueRule <Game>
            {
                ObjectToUpdate = "Ranking",
                SourceDataRule = new ConstantRule <int> {
                    Value = "1000"
                }
            };
            var descriptionChangeRule = new UpdateValueRule <Game>
            {
                ObjectToUpdate = "Description",
                SourceDataRule = new ConstantRule <string> {
                    Value = "some cool description"
                }
            };

            var blockRule = new ActionBlockRule <Game>();

            blockRule.Rules.Add(nameChangeRule);
            blockRule.Rules.Add(rankingChangeRule);
            blockRule.Rules.Add(descriptionChangeRule);

            var conditionalUpdateValue = new ConditionalIfThActionRule <Game>
            {
                ConditionRule = new MethodCallRule <Game, bool>
                {
                    ObjectToCallMethodOn = "Name",
                    MethodToCall         = "Equals",
                    MethodParameters     = { new ConstantRule <string>       {
                                                 Value = "some name"
                                             },
                                             new ConstantRule <StringComparison> {
                                                 Value = "CurrentCultureIgnoreCase"
                                             } }
                },
                TrueRule = blockRule
            };

            var compileResult = conditionalUpdateValue.Compile();

            compileResult.Should().BeTrue();
            _testOutputHelper.WriteLine($"{nameof(conditionalUpdateValue)}:{Environment.NewLine}" +
                                        $"{conditionalUpdateValue.ExpressionDebugView()}");

            var game = new Game {
                Name = "some name"
            };

            _testOutputHelper.WriteLine($"before game.Name: {game.Name}");
            conditionalUpdateValue.Execute(game);
            _testOutputHelper.WriteLine($"after game.Name: {game.Name}");
            game.Name.Should().Be("some fancy name");
            game.Ranking.Should().Be(1000);
            game.Description.Should().Be("some cool description");
            _testOutputHelper.WriteLine($"{game}");
        }