private GSDLock AcquireGSDLock(ITracer mockTracer)
        {
            GSDLock gvfsLock = new GSDLock(mockTracer);

            this.ValidateLockIsFree(gvfsLock);
            gvfsLock.TryAcquireLockForGSD().ShouldBeTrue();
            this.ValidateLockHeldByGSD(gvfsLock);
            return(gvfsLock);
        }
        public void TryAcquireLockForGSD_WhenExternalLock()
        {
            Mock <ITracer> mockTracer = new Mock <ITracer>(MockBehavior.Strict);

            mockTracer.Setup(x => x.RelatedEvent(EventLevel.Informational, "TryAcquireLockExternal", It.IsAny <EventMetadata>()));
            mockTracer.Setup(x => x.RelatedEvent(EventLevel.Verbose, "TryAcquireLockInternal", It.IsAny <EventMetadata>()));
            MockPlatform mockPlatform = (MockPlatform)GSDPlatform.Instance;
            GSDLock      gvfsLock     = this.AcquireDefaultLock(mockPlatform, mockTracer.Object);

            gvfsLock.TryAcquireLockForGSD().ShouldBeFalse();
            mockPlatform.ActiveProcesses.Remove(DefaultLockData.PID);
            mockTracer.VerifyAll();
        }
        public void TryAcquireLockForGSD()
        {
            Mock <ITracer> mockTracer = new Mock <ITracer>(MockBehavior.Strict);

            mockTracer.Setup(x => x.RelatedEvent(EventLevel.Verbose, "TryAcquireLockInternal", It.IsAny <EventMetadata>()));
            mockTracer.Setup(x => x.RelatedEvent(EventLevel.Verbose, "ReleaseLockHeldByGSD", It.IsAny <EventMetadata>()));
            GSDLock gvfsLock = this.AcquireGSDLock(mockTracer.Object);

            // Should be able to call again when GSD has the lock
            gvfsLock.TryAcquireLockForGSD().ShouldBeTrue();
            this.ValidateLockHeldByGSD(gvfsLock);

            gvfsLock.ReleaseLockHeldByGSD();
            this.ValidateLockIsFree(gvfsLock);
            mockTracer.VerifyAll();
        }