You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
1.0 KiB

  1. using System;
  2. using NUnit.Framework;
  3. using UnityEngine;
  4. using UnityEngine.Analytics;
  5. public class JsonSerialization
  6. {
  7. // This test was create to verifiy JsonUtility could properly deserialize the nested
  8. // structs used for opt-out status. That process is now handled with remote config so
  9. // now we just verify that the expected response from the token API can be deserialized.
  10. const string kTokenJson = "{" +
  11. "\"url\": \"https://analytics.cloud.unity3d.com/optout?token=24a96770b5c4420a4f930dbb4b72fbb83erfg3edf3ert4r1/\"," +
  12. "\"token\": \"24a96770b5c4420a4f930dbb4b72fbb83erfg3edf3ert4r1\"" +
  13. "}";
  14. [Test]
  15. public void TestTokenStruct_JsonUtility()
  16. {
  17. var tokenData = JsonUtility.FromJson<DataPrivacy.TokenData>(kTokenJson);
  18. Assert.AreEqual("https://analytics.cloud.unity3d.com/optout?token=24a96770b5c4420a4f930dbb4b72fbb83erfg3edf3ert4r1/", tokenData.url);
  19. Assert.AreEqual("24a96770b5c4420a4f930dbb4b72fbb83erfg3edf3ert4r1", tokenData.token);
  20. }
  21. }