Exemplo n.º 1
0
    public void Setup()
    {
        var properties = new Dictionary <string, object>(StringComparer.Ordinal);

        dictionary = properties;

        jsonData        = JsonData.Create(s_demo_payload);
        dynamicJsonData = jsonData;

        data        = new DynamicData();
        dynamicData = data;

        foreach (var property in jsonData.PropertyNames)
        {
            properties.Add(property, jsonData[property]);
            data[property] = jsonData[property];
        }

        searchDocument        = new SearchDocument(properties);
        dynamicSearchDocument = searchDocument;

        staticObject  = (Payload)dynamicJsonData;
        dynamicObject = staticObject;

        handcraftedHash        = new DynamicData(new PerfectStore(properties));
        dynamicHandcraftedHash = handcraftedHash;

        perfectHash        = new DynamicData(PerfectHashStore.Create(properties));
        dynamicPerfectHash = perfectHash;
    }
Exemplo n.º 2
0
        public void PerfectHash()
        {
            var dictionary = new Dictionary <string, object>();

            dictionary.Add("a", 1);

            PropertyStore store;

            store = PerfectHashStore.Create(dictionary);
            Assert.IsNotNull(store);

            dictionary.Add("b", 2);
            store = PerfectHashStore.Create(dictionary);
            Assert.IsNotNull(store);
        }