Пример #1
0
        public void GetApplicablePermutationsForTheseConditions()
        {
            // arrange
            ConditionFactory       factory = new ConditionFactory();
            HashSet <ConditionKey> keys    = new HashSet <ConditionKey> {
                ConditionKey.DayOfWeek, ConditionKey.Season
            };
            ConditionDictionary conditions = factory.BuildEmpty();

            // act
            IEnumerable <IDictionary <ConditionKey, string> > permutations = factory.GetApplicablePermutationsForTheseConditions(keys, conditions);

            // assert
            IEnumerable <string> actual   = permutations.Select(permutation => "(" + this.SortAndCommaDelimit(permutation.Select(p => $"{p.Key}:{p.Value}")) + ")");
            List <string>        expected = new List <string>();

            foreach (DayOfWeek dayOfWeek in this.DaysOfWeek)
            {
                foreach (string season in this.Seasons)
                {
                    expected.Add($"({ConditionKey.DayOfWeek}:{dayOfWeek}, {ConditionKey.Season}:{season})");
                }
            }

            this.SortAndCommaDelimit(actual).Should().Be(this.SortAndCommaDelimit(expected));
        }