public void When_PagesWithNotRequired_conditions_with_containsAllOf(string[] containsAllValues, string applicationDataValue, bool match)
        {
            var expectedPagesCount = 1;

            if (!match)
            {
                expectedPagesCount = 2;
            }

            var pageIdAlwaysPresent       = "3";
            var pageIdAbsentIfNotRequired = "2";
            var applicationDataJson       = JsonConvert.SerializeObject(new
            {
                FieldToTest = applicationDataValue
            });

            var applicationData = JObject.Parse(applicationDataJson);

            var pages = new List <Page>
            {
                new Page
                {
                    PageId = pageIdAbsentIfNotRequired,
                    NotRequiredConditions = new List <NotRequiredCondition>
                    {
                        new NotRequiredCondition
                        {
                            Field         = "FieldToTest",
                            ContainsAllOf = containsAllValues
                        }
                    },
                    Next = new List <Next>
                    {
                        new Next
                        {
                            Action     = "NextPage",
                            ReturnId   = "12",
                            Conditions = new List <Condition>()
                        },
                        new Next
                        {
                            Action     = "NextPage",
                            ReturnId   = "14",
                            Conditions = new List <Condition>()
                        }
                    }
                },
                new Page
                {
                    PageId = pageIdAlwaysPresent,
                    NotRequiredConditions = null
                }
            };

            var notRequiredProcessor = new NotRequiredProcessor();
            var actualPages          = notRequiredProcessor.PagesWithoutNotRequired(pages, applicationData);

            Assert.AreEqual(actualPages.Count(), expectedPagesCount);
            Assert.IsTrue(actualPages.Any(p => p.PageId == pageIdAlwaysPresent));
            Assert.AreNotEqual(actualPages.Any(p => p.PageId == pageIdAbsentIfNotRequired), match);
        }
        public void When_PagesWithNotRequired_DoesNotContain_conditions_are_removed(string notRequiredConditionValue, string applicationDataValue, bool toRemove, bool singleValue, string explanation)
        {
            var expectedPagesCount = 2;

            if (toRemove)
            {
                expectedPagesCount = 1;
            }

            var pageIdAlwaysPresent       = "3";
            var pageIdAbsentIfNotRequired = "2";
            var applicationDataJson       = JsonConvert.SerializeObject(new
            {
                FieldToTest = applicationDataValue
            });

            var applicationData    = JObject.Parse(applicationDataJson);
            var doesNotContainList = new string[] { notRequiredConditionValue };

            if (!singleValue)
            {
                doesNotContainList = new string[] { "value1", notRequiredConditionValue, "value2" }
            }
            ;

            var pages = new List <Page>
            {
                new Page
                {
                    PageId = pageIdAbsentIfNotRequired,
                    NotRequiredConditions = new List <NotRequiredCondition>
                    {
                        new NotRequiredCondition()
                        {
                            Field          = "FieldToTest",
                            DoesNotContain = doesNotContainList
                        }
                    },
                    Next = new List <Next>
                    {
                        new Next
                        {
                            Action     = "NextPage",
                            ReturnId   = "12",
                            Conditions = new List <Condition>()
                        },
                        new Next
                        {
                            Action     = "NextPage",
                            ReturnId   = "14",
                            Conditions = new List <Condition>()
                        }
                    }
                },
                new Page
                {
                    PageId = pageIdAlwaysPresent,
                    NotRequiredConditions = null
                }
            };

            var notRequiredProcessor = new NotRequiredProcessor();
            var actualPages          = notRequiredProcessor.PagesWithoutNotRequired(pages, applicationData);

            Assert.AreEqual(actualPages.ToList().Count, expectedPagesCount);
            Assert.IsTrue(actualPages.Any(p => p.PageId == pageIdAlwaysPresent));
            Assert.AreNotEqual(actualPages.Any(p => p.PageId == pageIdAbsentIfNotRequired), toRemove);
        }
    }