public void Setup() { var content = Enumerable.Range(0, N).Select(i => new KeyValuePair <string, int>(i.ToString(), i)); dictionary = new Dictionary <string, int>(content); immutableDictionary = ImmutableDictionary.CreateBuilder <string, int>(); immutableTrieDictionary = ImmutableTrieDictionary.CreateBuilder <string, int>(); immutableDictionary.AddRange(content); immutableTrieDictionary.AddRange(content); }
public void Setup() { immutableDictionary = ImmutableDictionary.CreateBuilder <string, int>(); immutableTrieDictionary = ImmutableTrieDictionary.CreateBuilder <string, int>(); dictionary = new Dictionary <string, int>(); for (int i = 0; i < N; i++) { var key = $"{i},{i}"; immutableDictionary[key] = i; immutableTrieDictionary[key] = i; dictionary[key] = i; } }
public void CreateBuilder() { var builder = ImmutableTrieDictionary.CreateBuilder <string, string>(); Assert.Same(EqualityComparer <string> .Default, builder.KeyComparer); Assert.Same(EqualityComparer <string> .Default, builder.ValueComparer); builder = ImmutableTrieDictionary.CreateBuilder <string, string>(StringComparer.Ordinal); Assert.Same(StringComparer.Ordinal, builder.KeyComparer); Assert.Same(EqualityComparer <string> .Default, builder.ValueComparer); builder = ImmutableTrieDictionary.CreateBuilder <string, string>(StringComparer.Ordinal, StringComparer.OrdinalIgnoreCase); Assert.Same(StringComparer.Ordinal, builder.KeyComparer); Assert.Same(StringComparer.OrdinalIgnoreCase, builder.ValueComparer); }
public void Setup() { immutableDictionary = ImmutableDictionary.CreateBuilder <string, int>(); immutableTrieDictionary = ImmutableTrieDictionary.CreateBuilder <string, int>(); dictionary = new Dictionary <string, int>(); }