public void GetPossibleValues_WithOnlyImpliedConditions() { // arrange ConditionFactory factory = new ConditionFactory(); ConditionDictionary conditions = factory.BuildEmpty(); // act IDictionary <ConditionKey, InvariantHashSet> possibleValues = factory.GetPossibleTokenisableValues(conditions); // assert foreach (ConditionKey key in this.TokenisableConditions) { this.SortAndCommaDelimit(possibleValues[key]).Should().Be(this.CommaDelimitedValues[key], $"should match for {key}"); } }
public void GetPossibleValues_WithImpliedConditionsAndRestrictedDaysOfWeek() { // arrange ConditionFactory factory = new ConditionFactory(); ConditionDictionary conditions = factory.BuildEmpty(); conditions.Add(ConditionKey.DayOfWeek, new[] { DayOfWeek.Tuesday.ToString(), DayOfWeek.Wednesday.ToString() }); // act IDictionary <ConditionKey, InvariantHashSet> possibleValues = factory.GetPossibleTokenisableValues(conditions); // assert this.SortAndCommaDelimit(possibleValues[ConditionKey.Day]).Should().Be("10, 16, 17, 2, 23, 24, 3, 9", $"should match for {ConditionKey.Day}"); this.SortAndCommaDelimit(possibleValues[ConditionKey.DayOfWeek]).Should().Be($"{DayOfWeek.Tuesday}, {DayOfWeek.Wednesday}", $"should match for {ConditionKey.DayOfWeek}"); this.SortAndCommaDelimit(possibleValues[ConditionKey.Language]).Should().Be(this.CommaDelimitedValues[ConditionKey.Language], $"should match for {ConditionKey.Language}"); this.SortAndCommaDelimit(possibleValues[ConditionKey.Season]).Should().Be(this.CommaDelimitedValues[ConditionKey.Season], $"should match for {ConditionKey.Season}"); this.SortAndCommaDelimit(possibleValues[ConditionKey.Weather]).Should().Be(this.CommaDelimitedValues[ConditionKey.Weather], $"should match for {ConditionKey.Weather}"); }
public void GetPossibleValues_WithSubsetForEachCondition() { // arrange ConditionFactory factory = new ConditionFactory(); ConditionDictionary conditions = factory.BuildEmpty(); conditions.Add(ConditionKey.Day, new[] { "1" /*Monday*/, "2" /*Tuesday*/, "17" /*Wednesday*/, "26" /*Friday*/, "28" /*Sunday*/ }); conditions.Add(ConditionKey.DayOfWeek, new[] { DayOfWeek.Monday.ToString(), DayOfWeek.Thursday.ToString(), DayOfWeek.Saturday.ToString(), DayOfWeek.Sunday.ToString() }); conditions.Add(ConditionKey.Language, new[] { LocalizedContentManager.LanguageCode.en.ToString(), LocalizedContentManager.LanguageCode.pt.ToString() }); conditions.Add(ConditionKey.Season, new[] { "Spring", "Fall" }); conditions.Add(ConditionKey.Weather, new InvariantHashSet { Weather.Rain.ToString(), Weather.Sun.ToString() }); // act IDictionary <ConditionKey, InvariantHashSet> possibleValues = factory.GetPossibleTokenisableValues(conditions); // assert this.SortAndCommaDelimit(possibleValues[ConditionKey.Day]).Should().Be("1, 28", $"should match for {ConditionKey.Day}"); this.SortAndCommaDelimit(possibleValues[ConditionKey.DayOfWeek]).Should().Be($"{DayOfWeek.Monday}, {DayOfWeek.Sunday}", $"should match for {ConditionKey.DayOfWeek}"); this.SortAndCommaDelimit(possibleValues[ConditionKey.Language]).Should().Be($"{LocalizedContentManager.LanguageCode.en}, {LocalizedContentManager.LanguageCode.pt}", $"should match for {ConditionKey.Language}"); this.SortAndCommaDelimit(possibleValues[ConditionKey.Season]).Should().Be("Fall, Spring", $"should match for {ConditionKey.Season}"); this.SortAndCommaDelimit(possibleValues[ConditionKey.Weather]).Should().Be($"{Weather.Rain}, {Weather.Sun}", $"should match for {ConditionKey.Weather}"); }