com.wallstop-studios.unity-helpers 2.0.0-rc51 → 2.0.0-rc52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,15 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
public sealed class DeferredDisposalResult<T>
|
|
7
7
|
{
|
|
8
|
-
public T
|
|
8
|
+
public readonly T result;
|
|
9
|
+
|
|
9
10
|
private readonly Func<Task> _disposeAsync;
|
|
10
11
|
|
|
11
12
|
public DeferredDisposalResult(T result, Func<Task> disposeAsync)
|
|
12
13
|
{
|
|
13
|
-
|
|
14
|
-
_disposeAsync = disposeAsync;
|
|
14
|
+
this.result = result;
|
|
15
|
+
_disposeAsync = disposeAsync ?? throw new ArgumentNullException(nameof(disposeAsync));
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
public Task DisposeAsync()
|
|
18
|
+
public async Task DisposeAsync()
|
|
19
|
+
{
|
|
20
|
+
await _disposeAsync();
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
}
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
Assert.IsTrue(task.IsCompletedSuccessfully, task.Exception?.ToString() ?? string.Empty);
|
|
67
67
|
|
|
68
68
|
_disposalTasks.Add(task.Result.DisposeAsync);
|
|
69
|
-
SpriteRenderer found = task.Result.
|
|
69
|
+
SpriteRenderer found = task.Result.result;
|
|
70
70
|
Assert.IsTrue(found != null);
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
|
|
86
86
|
Assert.IsTrue(task.IsCompletedSuccessfully, task.Exception?.ToString() ?? string.Empty);
|
|
87
87
|
_disposalTasks.Add(task.Result.DisposeAsync);
|
|
88
|
-
SpriteRenderer[] found = task.Result.
|
|
88
|
+
SpriteRenderer[] found = task.Result.result;
|
|
89
89
|
Assert.That(found, Has.Length.EqualTo(7));
|
|
90
90
|
}
|
|
91
91
|
}
|