Beispiel #1
0
        public async Task Filter_CouldHaveValue_ValueNotMatchesServerDUID()
        {
            Random   random     = new Random();
            UUIDDUID serverDuid = new UUIDDUID(random.NextGuid());

            DHCPv6PacketServerIdentifierFilter filter =
                new DHCPv6PacketServerIdentifierFilter(
                    serverDuid,
                    Mock.Of <ILogger <DHCPv6PacketServerIdentifierFilter> >());

            DHCPv6Packet packet = DHCPv6Packet.AsInner(
                1, DHCPv6PacketTypes.INFORMATION_REQUEST, new List <DHCPv6PacketOption>
            {
                new DHCPv6PacketIdentifierOption(DHCPv6PacketOptionTypes.ServerIdentifer, new UUIDDUID(random.NextGuid())),
            });

            Boolean result = await filter.ShouldPacketBeFiltered(packet);

            Assert.True(result);
        }
Beispiel #2
0
        public async Task Filter_ShouldNotHaveValue(Boolean valueIsPresented)
        {
            Random   random     = new Random();
            UUIDDUID serverDuid = new UUIDDUID(random.NextGuid());

            DHCPv6PacketServerIdentifierFilter filter =
                new DHCPv6PacketServerIdentifierFilter(
                    serverDuid,
                    Mock.Of <ILogger <DHCPv6PacketServerIdentifierFilter> >());

            var options = new List <DHCPv6PacketOption>();

            if (valueIsPresented == true)
            {
                options.Add(new DHCPv6PacketIdentifierOption(DHCPv6PacketOptionTypes.ServerIdentifer, serverDuid));
            }

            DHCPv6Packet packet = DHCPv6Packet.AsInner(
                1, DHCPv6PacketTypes.Solicit, options);

            Boolean result = await filter.ShouldPacketBeFiltered(packet);

            Assert.False(result);
        }