Example #1
0
        public void Roundtrip_Master()
        {
            var now = new DateTime(2018, 8, 13, 23, 59, 59, DateTimeKind.Utc);
            var a   = new TKEYRecord
            {
                Name       = "host.example.com",
                Algorithm  = TSIGRecord.HMACSHA1,
                Inception  = now,
                Expiration = now.AddSeconds(15),
                Mode       = KeyExchangeMode.DiffieHellman,
                Key        = new byte[] { 1, 2, 3, 4 },
                Error      = MessageStatus.BadTime,
                OtherData  = new byte[] { 5, 6 }
            };
            var b = (TKEYRecord) new ResourceRecord().Read(a.ToString());

            Assert.AreEqual(a.Name, b.Name);
            Assert.AreEqual(a.Class, b.Class);
            Assert.AreEqual(a.Type, b.Type);
            Assert.AreEqual(a.TTL, b.TTL);
            Assert.AreEqual(a.Algorithm, b.Algorithm);
            Assert.AreEqual(a.Inception, b.Inception);
            Assert.AreEqual(a.Expiration, b.Expiration);
            Assert.AreEqual(a.Mode, b.Mode);
            CollectionAssert.AreEqual(a.Key, b.Key);
            Assert.AreEqual(a.Error, b.Error);
            CollectionAssert.AreEqual(a.OtherData, b.OtherData);
        }
Example #2
0
        public void Defaults()
        {
            var tsig = new TKEYRecord();

            Assert.AreEqual(DnsType.TKEY, tsig.Type);
            Assert.AreEqual(DnsClass.ANY, tsig.Class);
            Assert.AreEqual(TimeSpan.Zero, tsig.TTL);
        }