public void TestCustomEntityPersistance()
 {
     TempClass t = new TempClass();
     t.Id = Guid.NewGuid();
     Kernel.Instance.ItemRepository.SaveItem(t);
     var copy = Kernel.Instance.ItemRepository.RetrieveItem(t.Id);
     Assert.IsInstanceOfType(typeof(TempClass), copy);
 }
Esempio n. 2
0
    public static TempClass LoadData()
    {
        BinaryFormatter binaryFormatter = new BinaryFormatter();

        try
        {
            FileStream stream = new FileStream(Application.persistentDataPath + "/UserVehicleList.txt", FileMode.Open);
            TempClass  data   = binaryFormatter.Deserialize(stream) as TempClass;
            stream.Close();

            return(data);
        }
        catch (System.Exception exe)
        {
            Debug.Log("Error while loading data: " + exe.ToString());
            return(null);
        }
    }