Пример #1
0
        public void Configuration_Windows(string property, int value)
        {
            using var device = GetPcapDevice();

            var config = new DeviceConfiguration();

            config.GetType().GetProperty(property).SetValue(config, value);

            device.Open(StrictConfig(config));
        }
Пример #2
0
        public void Configuration_NotWindows(string property, int value)
        {
            using var device = GetPcapDevice();
            var config = new DeviceConfiguration();

            config.GetType().GetProperty(property).SetValue(config, value);
            var failures = new List <ConfigurationFailedEventArgs>();

            config.ConfigurationFailed += (s, e) =>
            {
                failures.Add(e);
            };
            device.Open(config);
            Assert.That(failures, Has.Count.EqualTo(1));
            var fail = failures[0];

            Assert.AreEqual(property, fail.Property);
            Assert.AreEqual(PcapError.PlatformNotSupported, fail.Error);
        }