コード例 #1
0
        public IKey CreateMatchingKeyFor(ILock @lock)
        {
            var key = new FakeKey();

            foreach (var signature in _signatures)
            {
                key.Signature = signature;
                if (@lock.DoesMatch(key))
                {
                    return(key);
                }
            }
            throw new ImpossibleToPickTheLockException(@lock);
        }
コード例 #2
0
        public void Pick(ILock @lock)
        {
            var key = new FakeKey();

            foreach (var signature in _signatures)
            {
                key.Signature = signature;
                if (@lock.DoesMatch(key))
                {
                    @lock.Unlock(key);
                    if ([email protected])
                    {
                        return;
                    }
                }
            }
            throw new ImpossibleToPickTheLockException(@lock);
        }