public void PropertyContainer_SetValue_Conversion_Throws()
        {
            var container = new TestPrimitiveContainer();
            var value     = new NotSupportedType();

            Assert.Throws <InvalidOperationException>(() =>
            {
                PropertyContainer.SetValue(ref container, nameof(TestPrimitiveContainer.Int32Value), value);
            });
        }
Exemplo n.º 2
0
        public void ConvertTo_ValueIsOfInvalidType_ThrowsNotSupportedException()
        {
            // Setup
            var notSupportedValue = new NotSupportedType();
            var converter         = new EnumTypeConverter(typeof(SimpleEnum));

            // Call
            TestDelegate test = () => converter.ConvertTo(notSupportedValue, typeof(SimpleEnum));

            // Assert
            Assert.Throws <NotSupportedException>(test);
        }