Ejemplo n.º 1
0
        /// <summary>
        /// Writes this question using the specified
        /// <see cref="AK.Net.Dns.IDnsWriter"/>.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="writer"/> is <see langword="null"/>.
        /// </exception>
        public virtual void Write(IDnsWriter writer)
        {
            Guard.NotNull(writer, "writer");

            writer.WriteName(this.Name);
            writer.WriteQueryType(this.Type);
            writer.WriteQueryClass(this.Class);
        }
Ejemplo n.º 2
0
        public void write_writes_data_in_correct_order_and_with_correct_arguments()
        {
            MockRepository mocks    = new MockRepository();
            IDnsWriter     writer   = mocks.StrictMock <IDnsWriter>();
            DnsQuestion    question = new DnsQuestion(DnsName.Parse("test.com"), DnsQueryType.MX, DnsQueryClass.IN);

            using (mocks.Ordered()) {
                writer.WriteName(question.Name);
                writer.WriteQueryType(question.Type);
                writer.WriteQueryClass(question.Class);
            }
            mocks.ReplayAll();
            question.Write(writer);
            mocks.VerifyAll();
        }