public void FileHandling_compare_serialized_results_against_Pidgin_otr_fingerprints()
        {
            var fp1 = new fingerprint("marshal2", "*****@*****.**", "prpl-irc",
                "80724d46d9d906a28af31d15adfd510822ac3fd9", Statuses.verified);
            var fp2 = new fingerprint("marshal3", "*****@*****.**", "prpl-irc",
                "18dcd190ccaad02aed74e69d3b96355e61a82b3e", Statuses.verified);
            var fp3 = new fingerprint("test123_4", "*****@*****.**", "prpl-irc",
                "64bfb577c9591b3dbb6b697599f572ce7d1ffc9d", Statuses.smp);
            var fp4 = new fingerprint("testuser2", "*****@*****.**", "prpl-irc",
                "51f2e7db2a0c14facd568107aceaae73f362c869", Statuses.smp);

            var fingerprints = new Collection<fingerprint> { fp1, fp2, fp3, fp4 };

            string actual = ParseOtrFingerprintsFile.Serialize(fingerprints);
            string expected = _fingerprints;

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        /// <summary>
        ///     Deserialize string to <see cref="privkeys" /> object.
        /// </summary>
        /// <param name="item">Serialized string.</param>
        /// <returns>A <see cref="privkeys" /> object.</returns>
        internal static fingerprint Deserialize(string line)
        {
            var fp = new fingerprint();

            string[] parts = line.Split('\t');
            fp.Username = parts[0];
            fp.Account = parts[1];
            fp.Protocol = parts[2];
            fp.Fingerprint = parts[3];

            if (fp.Fingerprint.Length != 40)
            {
                Log.Error("Fingerprint is of incorrect size (!=40 characters)");
            }

            var status = Statuses.smp;

            Enum.TryParse(parts[4], out status);

            fp.Status = status;

            return fp;
        }