public void ShouldCreateTest()
        {
            using (ResourceManager resourceManager = new ResourceManager())
            {
                Guid?       __ = resourceManager.Enter();
                IDisposable disposable;

                disposable = new MockDualLifecycle();
                resourceManager.Watching(__, disposable);

                disposable = new MockDualLifecycle();
                //resourceManager.Using(__, disposable);
                using (resourceManager.Using(__, disposable))
                {
                }

                resourceManager.Leave(__);

                resourceManager.Check();
            }
        }
Example #2
0
        public async ValueTask ShouldCreateTestAsync()
        {
            await using (ResourceManager resourceManager = new ResourceManager())
            {
                Guid?__ = await resourceManager.EnterAsync();

                IAsyncDisposable asyncDisposable;

                asyncDisposable = new MockDualLifecycle();
                await resourceManager.WatchingAsync(__, asyncDisposable);

                asyncDisposable = new MockDualLifecycle();
                //resourceManager.UsingAsync(__, disposable);
                await using (await resourceManager.UsingAsync(__, asyncDisposable))
                {
                }

                await resourceManager.LeaveAsync(__);

                await resourceManager.CheckAsync();
            }
        }