Exemple #1
0
        public void SrvResourceRecordWithEmptyDomain()
        {
            byte[] content = Helper.ReadFixture("ResourceRecord", "empty-domain_srv");

            Domain domain             = new Domain(Helper.GetArray <string>());
            Domain target             = new Domain(Helper.GetArray("example", "com"));
            ServiceResourceRecord srv = new ServiceResourceRecord(domain, 10, 60, 8080, target, new TimeSpan(0));

            Assert.Equal(content, srv.ToArray());
        }
Exemple #2
0
        public void SrvResourceRecordWithEmptyDomain()
        {
            int endOffset = 0;

            byte[] content = Helper.ReadFixture("ResourceRecord", "empty-domain_srv");

            ResourceRecord record = ResourceRecord.FromArray(content, 0, out endOffset);

            Assert.Equal("", record.Name.ToString());
            Assert.Equal(Helper.GetArray <byte>(0, 10, 0, 60, 31, 144, 7, 101, 120, 97, 109, 112, 108, 101, 3, 99, 111, 109, 0), record.Data);
            Assert.Equal(RecordType.SRV, record.Type);
            Assert.Equal(RecordClass.IN, record.Class);
            Assert.Equal(new TimeSpan(0), record.TimeToLive);
            Assert.Equal(30, record.Size);
            Assert.Equal(30, endOffset);

            ServiceResourceRecord srv = new ServiceResourceRecord(record, content, 11);

            Assert.Equal(10, srv.Priority);
            Assert.Equal(60, srv.Weight);
            Assert.Equal(8080, srv.Port);
            Assert.Equal("example.com", srv.Target.ToString());
        }