示例#1
0
        public void TestOscSerializerExceptionWhenUnsupportedType()
        {
            OscMessage msg = null;

            try
            {
                msg = new OscMessage("/test", new UnknownType());
            }
            catch (OscSerializerException e)
            {
                msg = null;
                e.InnerException.Should().BeOfType <KeyNotFoundException>();
                e.Message.Should().Be($"Unsupported type: {typeof(UnknownType)}");
            }

            msg.Should().BeNull();
        }
示例#2
0
        public void TestNestedArrayNotSupported()
        {
            var value = new object[2];

            value[0] = "foo";
            value[1] = new object[] { 3, "boo" };

            var        success = false;
            OscMessage msg;

            try
            {
                msg = new OscMessage("/test", value);
            }
            catch (OscSerializerException e)
            {
                e.Message.Should().Be("Nested arrays are not supported.");
                success = true;
                msg     = null;
            }

            success.Should().BeTrue();
            msg.Should().BeNull();
        }