public void ReleaseLockHeldByExternalProcess_WhenGSDHasLock() { 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.Informational, "ReleaseLockHeldByExternalProcess", It.IsAny <EventMetadata>(), Keywords.Telemetry)); GSDLock gvfsLock = this.AcquireGSDLock(mockTracer.Object); gvfsLock.ReleaseLockHeldByExternalProcess(DefaultLockData.PID).ShouldBeFalse(); this.ValidateLockHeldByGSD(gvfsLock); mockTracer.VerifyAll(); }
public void ReleaseLockHeldByExternalProcess_DifferentPID() { Mock <ITracer> mockTracer = new Mock <ITracer>(MockBehavior.Strict); mockTracer.Setup(x => x.RelatedEvent(EventLevel.Informational, "ReleaseLockHeldByExternalProcess", It.IsAny <EventMetadata>(), Keywords.Telemetry)); mockTracer.Setup(x => x.RelatedEvent(EventLevel.Informational, "TryAcquireLockExternal", It.IsAny <EventMetadata>())); MockPlatform mockPlatform = (MockPlatform)GSDPlatform.Instance; GSDLock gvfsLock = this.AcquireDefaultLock(mockPlatform, mockTracer.Object); gvfsLock.ReleaseLockHeldByExternalProcess(4321).ShouldBeFalse(); this.ValidateLockHeld(gvfsLock, DefaultLockData); mockTracer.VerifyAll(); }
public void TryAcquireAndReleaseLockForExternalRequestor() { 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.Informational, "ReleaseLockHeldByExternalProcess", It.IsAny <EventMetadata>(), Keywords.Telemetry)); MockPlatform mockPlatform = (MockPlatform)GSDPlatform.Instance; GSDLock gvfsLock = this.AcquireDefaultLock(mockPlatform, mockTracer.Object); mockPlatform.ActiveProcesses.Remove(DefaultLockData.PID); gvfsLock.ReleaseLockHeldByExternalProcess(DefaultLockData.PID); this.ValidateLockIsFree(gvfsLock); mockTracer.VerifyAll(); }