public void ReleaseWriteLockCallsUnderlyingAPI(Fake <IAdvApi32> advApi32, int serviceControlManagerHandlerValue,
                                                       int serviceDatabaseLockHandleValue)
        {
            var sut = new ServiceDatabaseConnection(advApi32.FakedObject);

            var connectionHandle = new ConnectionHandle
            {
                ServiceManagerHandle      = new IntPtr(serviceControlManagerHandlerValue),
                ServiceDatabaseLockHandle = new IntPtr(serviceDatabaseLockHandleValue)
            };

            sut.ReleaseLock(connectionHandle);

            advApi32.CallsTo(_ => _.ReleaseServiceDatabaseLock(A <IntPtr> ._)).MustHaveHappened();
        }
        public void ReleaseWriteLockResetsDatabaseLockHandle(Fake <IAdvApi32> advApi32, int serviceControlManagerHandlerValue,
                                                             int serviceDatabaseLockHandleValue)
        {
            advApi32.CallsTo(_ => _.ReleaseServiceDatabaseLock(A <IntPtr> ._))
            .Returns(true);

            var sut = new ServiceDatabaseConnection(advApi32.FakedObject);

            var connectionHandle = new ConnectionHandle
            {
                ServiceManagerHandle      = new IntPtr(serviceControlManagerHandlerValue),
                ServiceDatabaseLockHandle = new IntPtr(serviceDatabaseLockHandleValue)
            };

            sut.ReleaseLock(connectionHandle);

            var actual   = connectionHandle.ServiceDatabaseLockHandle;
            var expected = IntPtr.Zero;

            Assert.Equal(expected, actual);
        }