public void SignatureDataProducesConsistentStringOutput()
        {
            const string expected = "GET http://localhost:5000/api/test/1?value=2011-12-20T12:13:21Z\r\n"
                                    + "a1d76f81-de54-498c-8ccf-7ed9e069596a\r\n"
                                    + "1324383201\r\n"
                                    + "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=\r\n";
            var data = new SignatureData(TestMethod, TestUri, TestNonce, TestClock.TestValue, TestContentHash);

            data.ToString().Should().Be(expected);
        }
Ejemplo n.º 2
0
        public void ToStringTest()
        {
            SignatureData tag = TestUtil.GetCompositeTag <SignatureData>(Constants.SignatureData.TagType,
                                                                         new ITlvTag[]
            {
                new StringTag(Constants.SignatureData.SignatureTypeTagType, false, false, "Test SignatureType"),
                new RawTag(Constants.SignatureData.SignatureValueTagType, false, false, new byte[] { 0x2 }),
                new RawTag(Constants.SignatureData.CertificateIdTagType, false, false, new byte[] { 0x3 }),
                new StringTag(Constants.SignatureData.CertificateRepositoryUriTagType, false, false, "Test CertificateRepositoryUri")
            });

            SignatureData tag2 = new SignatureData(new RawTag(tag.Type, tag.NonCritical, tag.Forward, tag.EncodeValue()));

            Assert.AreEqual(tag.ToString(), tag2.ToString());
        }