public void CreateConfigureDictionary_should_throws_during_configuration_attept_with_empth_list() { var paramsList = new[] { "test string" }.ToImmutableList(); var selector = new DictionaryBasedSelector<string>(paramsList); var freqList = new List<int>().ToImmutableList(); Assert.Throws<Exception>(delegate { selector.Configure(freqList); }); }
public void GetAppropriateValue_should_throws_if_got_unknown_frequency() { var paramsList = new[] { "test string" }.ToImmutableList(); var selector = new DictionaryBasedSelector<string>(paramsList); var freqList = new[] {1, 2, 3}.ToImmutableList(); selector.Configure(freqList); Assert.Throws<Exception>(delegate { selector.GetAppropriateValue(0); }); }
public void Configure_should_make_selector_configurated() { var paramsList = new[] { "test string" }.ToImmutableList(); var selector = new DictionaryBasedSelector<string>(paramsList); var freqList = new[] { 1, 2, 3 }.ToImmutableList(); selector.Configure(freqList); Assert.AreEqual(false, selector.IsNotConfigurated()); }
public void CreateConfigureDictionary_should_create_dictionary_with_all_values_from_params_list() { var paramsList = new[] { "test string" }.ToImmutableList(); var selector = new DictionaryBasedSelector<string>(paramsList); var freqList = new[] { 1, 2, 3 }.ToImmutableList(); var resDictionary = selector.CreateConfiguredDictionary(freqList); CollectionAssert.IsSubsetOf(resDictionary.Values.Distinct(), paramsList); }
public void CreateConfigureDictionary_should_create_dictionary_with_all_keys_from_frequency_list() { var paramsList = new[] { "test string" }.ToImmutableList(); var selector = new DictionaryBasedSelector<string>(paramsList); var freqList = new[] { 1, 2, 3 }.ToImmutableList(); var resDictionary = selector.CreateConfiguredDictionary(freqList); CollectionAssert.AreEquivalent(freqList, resDictionary.Keys); }
public void GetAppropriateValue_should_throws_if_selector_is_not_configurated() { var paramsList = new[] { "test string" }.ToImmutableList(); var selector = new DictionaryBasedSelector<string>(paramsList); Assert.Throws<Exception>(delegate { selector.GetAppropriateValue(0); }); }