Exemplo n.º 1
0
        public void testEqualityOfInMemoryDictionary()
        {
            var randomvalues = new Dictionary <string, string>
            {
                { "KEYYYYYYY" + Random.value, "valuuuuuuuueeeee" + Random.value },
                { "chunky" + Random.value, "monkey" + Random.value },
                { "that " + Random.value, "funky" + Random.value },
                { "1234", "5678" },
                { "abc", "def" },
            };
            var inMemory    = new InMemoryKeyStore();
            var playerprefs = new PlayerPrefsKeyStore();
            var editor      = new EditorKeyStore();
            var values      = new List <string>();

            randomvalues.ForEach((KeyValuePair <string, string> kvp) => { values.Add(kvp.Value); });
            string valueStringNewlineDelimited = string.Join("\n", values.ToArray());
            var    fileProvider = new FileLineBasedKeyStore(getMemoryStream(valueStringNewlineDelimited), values);

            Assert.IsTrue(inMemory.otherDictionaryIsEqualOrASuperset(inMemory));
            Assert.IsTrue(inMemory.otherDictionaryIsEqualOrASuperset(playerprefs));
            Assert.IsTrue(inMemory.otherDictionaryIsEqualOrASuperset(editor));
            Assert.IsTrue(inMemory.otherDictionaryIsEqualOrASuperset(fileProvider));

            foreach (var kvp in randomvalues)
            {
                Debug.Log("Setting kvp:" + kvp.Key + " val" + kvp.Value);
                inMemory.set(kvp.Key, kvp.Value);
                playerprefs.set(kvp.Key, kvp.Value);
                editor.set(kvp.Key, kvp.Value);
                fileProvider.set(kvp.Key, kvp.Value);
            }
            standardCheck(inMemory, dictionary);
            standardCheck(playerprefs, dictionary);
            standardCheck(editor, dictionary);
            standardCheck(fileProvider, dictionary);

            Assert.IsTrue(inMemory.otherDictionaryIsEqualOrASuperset(inMemory));
            Assert.IsTrue(inMemory.otherDictionaryIsEqualOrASuperset(playerprefs));
            Assert.IsTrue(inMemory.otherDictionaryIsEqualOrASuperset(editor));
            Assert.IsTrue(inMemory.otherDictionaryIsEqualOrASuperset(fileProvider));

            var provider = new FileBasedCredentialProvider();

            Assert.AreEqual(provider.username, "*****@*****.**");
            Debug.Log("HELLO" + provider.username);
        }
Exemplo n.º 2
0
        public void testEditorKey()
        {
            var store = new EditorKeyStore();

            standardCheck(store, dictionary);
        }