Example #1
0
        public void ByteKey_should_be_structurally_different_for_different_arrays(Guid x, Guid y)
        {
            ByteKey key1 = x.ToByteArray();
            ByteKey key2 = y.ToByteArray();

            (key1 == key2).Should().BeFalse();
            (key2 == key1).Should().BeFalse();
        }
Example #2
0
        public void Setup()
        {
            var binary1 = new byte[100];
            var binary2 = new byte[100];

            SafeRandom.Current.NextBytes(binary1);
            // change binary2 on the last position
            binary1.CopyTo(binary2, 0);
            binary2[binary2.Length - 1] ^= binary2[binary2.Length - 1];

            key1 = binary1;
            key2 = binary2;
        }
Example #3
0
        public void ByteKey_should_be_structurally_comparable_when_arrays_have_the_same_content_but_different_references(byte[] expected)
        {
            var other = new byte[expected.Length];

            expected.CopyTo(other, 0);

            ByteKey key1 = expected;
            ByteKey key2 = other;

            ReferenceEquals(other, expected).Should().BeFalse();

            (key1 == key2).Should().BeTrue();
            (key2 == key1).Should().BeTrue();
        }
Example #4
0
 public static void PressButton(ByteKey key)
 {
     byte b = (byte)key;
     PressKey(b);
 }
Example #5
0
        public static void PressButton(ByteKey key)
        {
            byte b = (byte)key;

            PressKey(b);
        }
Example #6
0
 internal Var(KeyspaceType keyspace, ByteKey key)
 {
     this.keyspace = keyspace;
     this.key      = key;
 }
Example #7
0
 public static Global <B> Global <B>(ByteKey key) where B : class, IBinding => new Global <B>(key);
Example #8
0
 public static Local <B> Local <B>(ByteKey regionKey, ByteKey key) where B : class, IBinding => new Local <B>(regionKey, key);
Example #9
0
 public static Local <B> Local <B>(ByteKey regionKey, [NotNull] string key, Encoding encoding) where B : class, IBinding => new Local <B>(encoding.GetBytes(key));
Example #10
0
 public static Local <B> Local <B>(ByteKey regionKey, Guid key) where B : class, IBinding => new Local <B>(regionKey, key.ToByteArray());
Example #11
0
 public static Local <B> Local <B>(ByteKey regionKey, ulong key) where B : class, IBinding => new Local <B>(regionKey, BitConverter.GetBytes(key));