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.

58 lines
1.8 KiB

  1. using System;
  2. using NUnit.Framework;
  3. namespace UnityEngine.Analytics.Tests
  4. {
  5. public partial class AnalyticsEventTests
  6. {
  7. [Test]
  8. public void LevelStart_LevelIndexTest(
  9. [Values(-1, 0, 1)] int levelIndex
  10. )
  11. {
  12. Assert.DoesNotThrow(() => m_Result = AnalyticsEvent.LevelStart(levelIndex));
  13. EvaluateAnalyticsResult(m_Result);
  14. }
  15. [Test]
  16. public void LevelStart_LevelNameTest(
  17. [Values("test_level", "", null)] string levelName
  18. )
  19. {
  20. if (string.IsNullOrEmpty(levelName))
  21. {
  22. Assert.Throws<ArgumentException>(() => AnalyticsEvent.LevelStart(levelName));
  23. }
  24. else
  25. {
  26. Assert.DoesNotThrow(() => m_Result = AnalyticsEvent.LevelStart(levelName));
  27. EvaluateAnalyticsResult(m_Result);
  28. }
  29. }
  30. // [Test]
  31. // public void LevelStart_LevelIndex_LevelNameTest (
  32. // [Values(0)] int levelIndex,
  33. // [Values("test_level", "", null)] string levelName
  34. // )
  35. // {
  36. // Assert.DoesNotThrow(() => m_Result = AnalyticsEvent.LevelStart(levelIndex, levelName));
  37. // EvaluateAnalyticsResult(m_Result);
  38. // }
  39. [Test]
  40. public void LevelStart_CustomDataTest()
  41. {
  42. var levelIndex = 0;
  43. var levelName = "test_level";
  44. Assert.DoesNotThrow(() => m_Result = AnalyticsEvent.LevelStart(levelName, m_CustomData));
  45. EvaluateCustomData(m_CustomData);
  46. EvaluateAnalyticsResult(m_Result);
  47. Assert.DoesNotThrow(() => m_Result = AnalyticsEvent.LevelStart(levelIndex, m_CustomData));
  48. EvaluateCustomData(m_CustomData);
  49. EvaluateAnalyticsResult(m_Result);
  50. }
  51. }
  52. }