예제 #1
0
        public void MatchesExistingOrIsNew_OnNew_ReturnsTrue()
        {
            var bytes = new byte[] { 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xd6, 0x7a, 0xc2, 0xcc, 0x46, 0x99, 0xc3, 0x62, 0x3f, 0xe9, 0x88, 0x44, 0x99, 0xcf, 0x47, 0x96, 0xcd, 0x93, 0x78, 0x80, 0x9d, 0x52, 0x2e, 0x55, 0x2b, 0xed, 0x1e, 0xd4, 0x07, 0x90, 0x79, 0x02, 0x11, 0x8c, 0x1e, 0xb4, 0xad, 0x57, 0x01, 0x38, 0x80, 0xe4, 0xc7, 0x5a, 0x28, 0x96, 0x0a, 0xb4, 0x22, 0x45, 0x39, 0x5d, 0x41, 0x77, 0x35, 0xff, 0x91, 0x48, 0xa3, 0x81, 0x21, 0x79, 0x6b, 0xe0, 0x18, 0x39, 0x55, 0x0c, 0xc8, 0xce, 0xac, 0xe4, 0x0b, 0x33, 0x7d, 0xff, 0xc7, 0xf0, 0xb6, 0xe3, 0x6a, 0xbb, 0x73, 0xe8, 0x75, 0xbb, 0xdf, 0x98, 0x7b, 0x7d, 0x49, 0xec, 0x41, 0x04, 0x47, 0xb1, 0x21, 0x9a, 0x80, 0x9b, 0x37, 0x00, 0xe7, 0xb6, 0x4b, 0x02, 0xd1, 0x09, 0x15, 0x8c, 0x34, 0x86, 0xe8, 0xb5, 0xc1, 0x4f, 0x12, 0x6b, 0x9f, 0x29, 0x11, 0x9e, 0xe0, 0x86, 0x5f, 0x05, 0xdd, 0xac, 0x9d, 0xad, 0x03, 0x42, 0xf5, 0x5b, 0x35, 0xde, 0x95, 0xe9, 0xcc, 0xf6, 0x9f, 0xa1, 0x3f, 0xde, 0xb7, 0xb5, 0xb8, 0xa9, 0x27, 0xaf, 0x22, 0xe7, 0xd9, 0xcd, 0xee, 0x6a, 0x33, 0xf7, 0xc5, 0xee, 0xbd, 0x9b, 0xf5, 0xf9, 0xf7, 0x0d, 0x54, 0xb8, 0xe8, 0x81, 0x6c, 0x85, 0x8d, 0x98, 0xb6, 0x93, 0xef, 0xa3, 0x83, 0xb6, 0x9a, 0xf1, 0x2c, 0x3a, 0xf9, 0xfd, 0x51, 0xbe, 0xcd, 0xf7, 0x7e, 0xad, 0x17, 0x31, 0x36, 0x1f, 0x59, 0xb1, 0x1a, 0x0c, 0x58, 0xd0, 0x82, 0x60, 0x5b, 0xbf, 0x15, 0xcd, 0x8f, 0x64, 0x11, 0xc6, 0x34, 0xa5, 0x98, 0x2d, 0xb4, 0x86, 0x04, 0xda, 0xcd, 0xe5, 0x83, 0x6b, 0xd1, 0x64, 0xee, 0x74, 0xd0, 0x24, 0x31, 0xbd, 0x9e, 0x94, 0x9f, 0x38, 0x82, 0x3a, 0x60, 0xf5, 0xdf, 0xc3, 0x24, 0xa1, 0x0a, 0x90, 0xb3, 0x44, 0x2c, 0xce, 0xfa, 0x2f, 0x61, 0xda, 0xda, 0x33, 0x02, 0x03, 0x01, 0x00, 0x01 };
            // Arrange
            var instance = new InMemoryKeyStore();
            // Act
            var result = instance.MatchesExistingOrAddIfNew("foo.com", new byte[] { 0, 1, 2, 3 });

            // Assert
            Assert.IsTrue(result);
        }
예제 #2
0
        public void MatchesExistingOrIsNew_IfCaseingChangeOnHost_ItDoesNotMatter()
        {
            // Arrange
            var instance = new InMemoryKeyStore();

            instance.MatchesExistingOrAddIfNew("foo.com", new byte[] { 0, 1, 2, 3 });
            // Act
            var result = instance.MatchesExistingOrAddIfNew("fOo.com", new byte[] { 0, 1, 2, 2 });

            // Assert
            Assert.IsFalse(result);
        }
예제 #3
0
        public void MatchesExisting_IfNew_ReturnsFalse()
        {
            // Arrange
            var instance = new InMemoryKeyStore();
            // Act
            var result  = instance.MatchesExisting("foo.com", new byte[] { 1, 2, 3 });
            var result2 = instance.MatchesExisting("foo.com", new byte[] { 1, 2, 3 });

            // Assert
            Assert.IsFalse(result, "First request should return false");
            Assert.IsFalse(result2, "Subsequent requests should return false");
        }
예제 #4
0
        public void MatchesExistingOrIsNew_IfPublicKeyDoesNotMatchExisting_ReturnsFalse()
        {
            // Arrange
            var instance = new InMemoryKeyStore();

            instance.MatchesExistingOrAddIfNew("foo.com", new byte[] { 0, 1, 2, 3 });
            // Act
            var result = instance.MatchesExistingOrAddIfNew("foo.com", new byte[] { 0, 1, 2, 2 });

            // Assert
            Assert.IsFalse(result);
        }