Beispiel #1
0
        public void TestSimpleThumbprintMatches()
        {
            IdentityPublicTag tag1 = new IdentityPublicTag(new LogOnIdentity(new Passphrase("allan")));
            IdentityPublicTag tag2 = new IdentityPublicTag(new LogOnIdentity(new Passphrase("allan")));

            Assert.That(tag1.Matches(tag2), "tag1 should match tag2 since they are based on the same passphrase.");
            Assert.That(tag2.Matches(tag1), "tag2 should match tag1 since they are based on the same passphrase.");
            Assert.That(tag1.Matches(tag1), "tag1 should match tag1 since they are the same instance.");
            Assert.That(tag2.Matches(tag2), "tag2 should match tag2 since they are the same instance.");
        }
Beispiel #2
0
        public static void TestArgumentNullConstructor()
        {
            string            nullString    = null;
            WatchedFolder     watchedFolder = null;
            IdentityPublicTag nullTag       = null;

            Assert.Throws <ArgumentNullException>(() => { watchedFolder = new WatchedFolder(nullString, IdentityPublicTag.Empty); });
            Assert.Throws <ArgumentNullException>(() => { watchedFolder = new WatchedFolder(String.Empty, nullTag); });
            Assert.Throws <ArgumentNullException>(() => { watchedFolder = new WatchedFolder(nullString, IdentityPublicTag.Empty); });
            if (watchedFolder != null)
            {
            }
        }
Beispiel #3
0
        public void TestDifferentAsymmetricIdentityAndSamePassphraseDoesNotMatch()
        {
            UserKeyPair key1 = new UserKeyPair(EmailAddress.Parse("*****@*****.**"), 512);
            UserKeyPair key2 = new UserKeyPair(EmailAddress.Parse("*****@*****.**"), 512);

            IdentityPublicTag tag1 = new IdentityPublicTag(new LogOnIdentity(new UserKeyPair[] { key1 }, new Passphrase("allan")));
            IdentityPublicTag tag2 = new IdentityPublicTag(new LogOnIdentity(new UserKeyPair[] { key2 }, new Passphrase("allan")));

            Assert.That(!tag1.Matches(tag2), "tag1 should not match tag2 since they are based on different asymmetric user email even if passphrase is the same.");
            Assert.That(!tag2.Matches(tag1), "tag2 should not match tag1 since they are based on different asymmetric user email even if passphrase is the same.");
            Assert.That(tag1.Matches(tag1), "tag1 should match tag1 since they are the same instance.");
            Assert.That(tag2.Matches(tag2), "tag2 should match tag2 since they are the same instance.");
        }
Beispiel #4
0
        public void TestAsymmetricIdentityButDifferentPassphraseMatches()
        {
            UserKeyPair key1 = new UserKeyPair(EmailAddress.Parse("*****@*****.**"), 512);
            UserKeyPair key2 = new UserKeyPair(EmailAddress.Parse("*****@*****.**"), 512);

            IdentityPublicTag tag1 = new IdentityPublicTag(new LogOnIdentity(new UserKeyPair[] { key1 }, new Passphrase("allan")));
            IdentityPublicTag tag2 = new IdentityPublicTag(new LogOnIdentity(new UserKeyPair[] { key2 }, new Passphrase("niklas")));

            Assert.That(tag1.Matches(tag2), "tag1 should match tag2 since they are based on the same asymmetric user email and passphrase.");
            Assert.That(tag2.Matches(tag1), "tag2 should match tag1 since they are based on the same asymmetric user email and passphrase.");
            Assert.That(tag1.Matches(tag1), "tag1 should match tag1 since they are the same instance.");
            Assert.That(tag2.Matches(tag2), "tag2 should match tag2 since they are the same instance.");
        }