Exemplo n.º 1
0
        public void TestAquire()
        {
            using (var context = new MainContext()) {
                var ret = context.Acquire();
                Assert.That(ret, Is.True);

                var threadAquiredContext = false;
                Task.Run(() => {
                    threadAquiredContext = context.Acquire();
                }).Wait();
                Assert.That(threadAquiredContext, Is.False);
            }

            Utility.AssertNoGLibLog();
        }
Exemplo n.º 2
0
        public void TestIsOwner()
        {
            using (var context = new MainContext()) {
                Assert.That(context.IsOwner, Is.False);
                context.Acquire();
                Assert.That(context.IsOwner, Is.True);
            }

            Utility.AssertNoGLibLog();
        }
Exemplo n.º 3
0
        public void TestRelease()
        {
            using (var context = new MainContext()) {
                Assume.That(context.IsOwner, Is.False);
                var ret = context.Acquire();
                Assume.That(ret, Is.True);
                Assume.That(context.IsOwner, Is.True);

                context.Release();
                Assert.That(context.IsOwner, Is.False);
            }

            Utility.AssertNoGLibLog();
        }