refactor(app): compose live presentation startup
This commit is contained in:
parent
aa6ffa5176
commit
88f32dc4e2
23 changed files with 1767 additions and 626 deletions
|
|
@ -64,6 +64,36 @@ public sealed class AnimationHookRegistrationSetTests
|
|||
registrations.Register(new Sink("late")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OwnedRegistrationReleasesExactlyAndRetriesItsOwnFailure()
|
||||
{
|
||||
int adds = 0;
|
||||
int removes = 0;
|
||||
bool fail = true;
|
||||
var sink = new Sink("owned");
|
||||
var registrations = new AnimationHookRegistrationSet(
|
||||
_ => adds++,
|
||||
_ =>
|
||||
{
|
||||
removes++;
|
||||
if (fail)
|
||||
throw new InvalidOperationException("retry");
|
||||
});
|
||||
|
||||
IDisposable binding = registrations.RegisterOwned(sink);
|
||||
Assert.Throws<InvalidOperationException>(() =>
|
||||
registrations.RegisterOwned(sink));
|
||||
Assert.Throws<InvalidOperationException>(binding.Dispose);
|
||||
fail = false;
|
||||
binding.Dispose();
|
||||
binding.Dispose();
|
||||
registrations.Dispose();
|
||||
|
||||
Assert.Equal(1, adds);
|
||||
Assert.Equal(2, removes);
|
||||
Assert.True(registrations.IsCleanupComplete);
|
||||
}
|
||||
|
||||
private sealed class Sink(string name) : IAnimationHookSink
|
||||
{
|
||||
public string Name { get; } = name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue