public void Should_Return_Non_Existent_Domain_Because_No_Entry_Matches()
 {
     var dnsResolver = Mock.Of<IDnsResolver>(mock => mock.Resolve(It.IsAny<DnsRequest>()) == new DnsResolutionResult());
     IDnsQueryHandler queryHandler = new DnsQueryHandler(dnsResolver);
     var message = new DnsMessage() {Questions = new List<DnsQuestion>() {new DnsQuestion("test", RecordType.A, RecordClass.Any)}};
     DnsMessageBase processedMessage = queryHandler.HandleQuery(message, null, ProtocolType.IP);
     processedMessage.ReturnCode.Should().Be(ReturnCode.NxDomain);
 }
 public void Should_Return_DNS_Error_Because_No_Entry_Was_Requested()
 {
     var dnsResolver = Mock.Of<IDnsResolver>();
     IDnsQueryHandler queryHandler = new DnsQueryHandler(dnsResolver);
     var message = new DnsMessage();
     DnsMessageBase processedMessage = queryHandler.HandleQuery(message, null, ProtocolType.IP);
     processedMessage.ReturnCode.Should().Be(ReturnCode.ServerFailure);
 }
 public void Should_Return_No_Error_Because_Entry_Matches()
 {
     var dnsResolver = Mock.Of<IDnsResolver>(mock => mock.Resolve(It.IsAny<DnsRequest>()) == new DnsResolutionResult()
     {
         DnsEntry = new DnsEntry() { Name = "test", IpV4 = "0.0.0.0"}
     });
     IDnsQueryHandler queryHandler = new DnsQueryHandler(dnsResolver);
     var message = new DnsMessage() { Questions = new List<DnsQuestion>() { new DnsQuestion("test", RecordType.A, RecordClass.Any) } };
     queryHandler.HandleQuery(message, null, ProtocolType.IP);
     message.ReturnCode.Should().Be(ReturnCode.NoError);
 }