Ejemplo n.º 1
0
        public void Data_DerivedClass()
        {
            var a = new ARecord {
                Address = IPAddress.Parse("127.0.0.1")
            };

            Assert.AreNotEqual(0, a.GetData().Length);
        }
Ejemplo n.º 2
0
        public void DataLength_DerivedClass()
        {
            var a = new ARecord {
                Address = IPAddress.Parse("127.0.0.1")
            };

            Assert.AreEqual(4, a.GetDataLength());
        }
Ejemplo n.º 3
0
        public void Roundtrip_Master()
        {
            var a = new ARecord
            {
                Name    = "emanon.org",
                Address = IPAddress.Parse("127.0.0.1")
            };
            var b = (ARecord) 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.Address, b.Address);
        }
Ejemplo n.º 4
0
        public void Equality()
        {
            var a = new ARecord
            {
                Name    = "emanon.org",
                Address = IPAddress.Parse("127.0.0.1")
            };
            var b = new ARecord
            {
                Name    = "emanon.org",
                Address = IPAddress.Parse("127.0.0.2")
            };

            Assert.IsTrue(a.Equals(a));
            Assert.IsFalse(a.Equals(b));
            Assert.IsFalse(a.Equals(null));
        }
Ejemplo n.º 5
0
        public void MustExist_ResourceRecord()
        {
            var rr = new ARecord
            {
                Name    = "local",
                Class   = DnsClass.IN,
                Address = IPAddress.Parse("127.0.0.0")
            };
            var prerequisites = new UpdatePrerequisiteList()
                                .MustExist(rr);
            var p = prerequisites.First() as ResourceRecord;

            Assert.IsNotNull(p);
            Assert.AreEqual(rr.Class, p.Class);
            Assert.AreEqual(rr.Name, p.Name);
            Assert.AreEqual(TimeSpan.Zero, p.TTL);
            Assert.AreEqual(rr.Type, p.Type);
            Assert.AreEqual(rr.GetDataLength(), p.GetDataLength());
            Assert.IsTrue(rr.GetData().SequenceEqual(p.GetData()));
        }
Ejemplo n.º 6
0
        public void DeleteResource()
        {
            var rr = new ARecord
            {
                Name    = "local",
                Class   = DnsClass.IN,
                Address = IPAddress.Parse("127.0.0.0")
            };
            var updates = new UpdateResourceList()
                          .DeleteResource(rr);
            var p = updates.First() as ResourceRecord;

            Assert.IsNotNull(p);
            Assert.AreEqual(DnsClass.None, p.Class);
            Assert.AreEqual(rr.Name, p.Name);
            Assert.AreEqual(TimeSpan.Zero, p.TTL);
            Assert.AreEqual(rr.Type, p.Type);
            Assert.AreEqual(rr.GetDataLength(), p.GetDataLength());
            Assert.IsTrue(rr.GetData().SequenceEqual(p.GetData()));
        }