public void DataStorage_JsonStorage_OverrideTest()
        {
            const string key         = "Config/TestKey";
            const string firstString = "I should be overriden";
            const string expected    = "I should override the previous data";

            IDataStorage storage = new JsonStorage();

            storage.StoreObject(firstString, key);
            storage.StoreObject(expected, key);

            var actual = storage.RestoreObject <string>(key);

            Assert.Equal(expected, actual);
        }
        public void TestJsonStorageStoreNullKey()
        {
            const string key         = null;
            const string dataToStore = "ABC";

            JsonStorage storage = new JsonStorage();

            storage.StoreObject(dataToStore, key);
        }
        public void DataStorage_JsonStorage_StoreObject_InvalidKeyTest()
        {
            const string key           = "configurationFile";
            const string objectToStore = "some information";

            IDataStorage storage = new JsonStorage();

            Assert.Throws <System.ArgumentException>(() => storage.StoreObject(objectToStore, key));
        }
        public void TestJsonStorageNoPathKey()
        {
            const string key         = "TestKey2";
            const string dataToStore = "ABC";
            JsonStorage  storage     = new JsonStorage();

            storage.StoreObject(dataToStore, key);

            string dataFromStorage = storage.RestoreObject <string>(key);

            Assert.Equal(expected: dataToStore, actual: dataFromStorage);
        }
Exemple #5
0
        public static void JsonStorageTest()
        {
            const string expected    = "I'm a unit test!";
            const string expectedKey = "xUnitTests/TEST";

            IDataStorage storage = new JsonStorage();

            storage.StoreObject(expected, expectedKey);

            var actual = storage.RestoreObject <string>(expectedKey);

            Assert.Equal(expected, actual);
            //Assert.Throws<FileNotFoundException>(() => storage.RestoreObject<object>("xUnitTests/FAKE-KEY"));
        }
        public void DataStorage_JsonStorage_HasObject_Existing()
        {
            IDataStorage storage = new JsonStorage();

            const string key = "Test/key";
            const int    obj = 6;

            storage.StoreObject(obj, key);

            const bool expected = true;
            var        actual   = storage.HasObject(key);

            Assert.Equal(expected, actual);
        }
 public static void Save()
 {
     JsonStorage.StoreObject(_usersPraises, _filePath);
 }
 public static void Save()
 {
     JsonStorage.StoreObject(_usersArchievements, _filePath);
 }
Exemple #9
0
 public static void Save()
 {
     JsonStorage.StoreObject(_nicknames, _filePath);
 }
Exemple #10
0
 public static void SaveInstances()
 {
     System.Console.WriteLine("Saving combat...");
     _jsonStorage.StoreObject(_dic, filepath);
 }
Exemple #11
0
 public static void SaveUsers()
 {
     System.Console.WriteLine("Saving users...");
     _jsonStorage.StoreObject(_dic, filepath);
 }
Exemple #12
0
 public static void Save()
 {
     JsonStorage.StoreObject(_usersWarnings, _filePath);
 }
 public static void Save()
 {
     JsonStorage.StoreObject(guildConfigs, filepath);
 }
Exemple #14
0
 private static void SaveUsers()
 {
     System.Console.WriteLine("Saving users...");
     _jsonStorage.StoreObject(_storage.GetDict(), filepath);
 }
Exemple #15
0
 private static void SaveUsers()
 {
     Console.WriteLine("Saving users...");
     JsonStorage.StoreObject(Accounts, Filepath);
 }
 public static void Save()
 {
     JsonStorage.StoreObject(_usersExp, _filepath);
 }