Beispiel #1
0
 public void TestDeviceAllowedMessages([NotNull] Dictionary <Type, uint> aExpectedMessageArgs)
 {
     Clear();
     // If we've updated a class with new messages, but haven't updated the device, fail.
     Assert.AreEqual(aExpectedMessageArgs.Count, bleDevice.GetAllowedMessageTypes().Count());
     foreach (var item in aExpectedMessageArgs)
     {
         Assert.True(bleDevice.GetAllowedMessageTypes().Contains(item.Key));
         Assert.NotNull(bleDevice.GetMessageAttrs(item.Key));
         if (item.Value == 0)
         {
             Assert.Null(bleDevice.GetMessageAttrs(item.Key).FeatureCount);
         }
         else
         {
             Assert.AreEqual(item.Value, bleDevice.GetMessageAttrs(item.Key).FeatureCount);
         }
     }
 }
Beispiel #2
0
        GetAllowedMessageTypesAsDictionary([NotNull] IButtplugDevice aDevice)
        {
            Dictionary <string, MessageAttributes> msgs = new Dictionary <string, MessageAttributes>();

            foreach (var msg in aDevice.GetAllowedMessageTypes())
            {
                msgs.Add(msg.Name, aDevice.GetMessageAttrs(msg));
            }

            return(msgs);
        }
Beispiel #3
0
        public void TestDeviceAllowedMessages([NotNull] Dictionary <Type, uint> aExpectedMessageArgs)
        {
            Clear();

            // If we've updated a class with new messages, but haven't updated the device, fail.
            bleDevice.AllowedMessageTypes.Count().Should().Be(aExpectedMessageArgs.Count);
            foreach (var item in aExpectedMessageArgs)
            {
                bleDevice.AllowedMessageTypes.Should().Contain(item.Key);
                bleDevice.GetMessageAttrs(item.Key).Should().NotBeNull();
                if (item.Value == 0)
                {
                    bleDevice.GetMessageAttrs(item.Key).FeatureCount.Should().BeNull();
                }
                else
                {
                    bleDevice.GetMessageAttrs(item.Key).FeatureCount.Should().Be(item.Value);
                }
            }
        }