-
-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathTestApplication.cs
More file actions
51 lines (45 loc) · 1.84 KB
/
Copy pathTestApplication.cs
File metadata and controls
51 lines (45 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.IO;
using Sentry.Unity.Integrations;
using UnityEngine;
namespace Sentry.Unity.Tests.Stubs;
public sealed class TestApplication : IApplication
{
/// <summary>
/// Default cache directory for tests, avoiding pollution of the project directory.
/// </summary>
public static readonly string DefaultPersistentDataPath = Path.Combine(Path.GetTempPath(), "sentry-unity-tests");
public TestApplication(
bool isEditor = true,
string productName = "TestApplication",
string version = "0.0.1-test",
string buildGUID = "",
string unityVersion = "",
string? persistentDataPath = null,
RuntimePlatform platform = RuntimePlatform.WindowsEditor)
{
IsEditor = isEditor;
ProductName = productName;
Version = version;
BuildGUID = buildGUID;
UnityVersion = unityVersion;
PersistentDataPath = persistentDataPath ?? DefaultPersistentDataPath;
Platform = platform;
}
public event Application.LogCallback? LogMessageReceived;
public event Action? LowMemory;
public event Action? Quitting;
public string ActiveSceneName => "TestSceneName";
public bool IsEditor { get; set; }
public string ProductName { get; }
public string Version { get; }
public string BuildGUID { get; }
public string UnityVersion { get; set; }
public string PersistentDataPath { get; set; }
public RuntimePlatform Platform { get; set; }
public NetworkReachability InternetReachability { get; set; } = NetworkReachability.ReachableViaLocalAreaNetwork;
private void OnLogMessageReceived(string condition, string stacktrace, LogType type)
=> LogMessageReceived?.Invoke(condition, stacktrace, type);
public void OnLowMemory() => LowMemory?.Invoke();
private void OnQuitting() => Quitting?.Invoke();
}