static int Main() { PropertyDescriptor property = MyTypeConverter.CreatePropertyDescriptor(isReadOnly: false); if (property.IsReadOnly) { return(-1); } property = MyTypeConverter.CreatePropertyDescriptor(isReadOnly: true); if (!property.IsReadOnly) { return(-2); } Type readOnlyAttributeType = property.Attributes[0].GetType(); if (readOnlyAttributeType.Name != "ReadOnlyAttribute") { return(-3); } // check to make sure the 'ReadOnlyAttribute.Default' static field is preserved if (readOnlyAttributeType.GetField("Default") == null) { return(-4); } return(100); }
public void CanConvertFromTest1() { tlog.Debug(tag, $"CanConvertFromTest1 START"); MyTypeConverter tc = new MyTypeConverter(); Assert.IsNotNull(tc, "null TypeConverter"); Assert.Throws <ArgumentNullException>(() => tc.CanConvertFrom(null)); tlog.Debug(tag, $"CanConvertFromTest1 END"); }
public void Toint() { //arrange var input = "123"; var expected = 123; //act int actual; actual = MyTypeConverter.Toint(input); //assert Assert.AreEqual(expected, actual); }
public void ToDecimal() { //arrange var input = "321"; decimal expected = 321; //act decimal actual; actual = MyTypeConverter.ToDecimal(input); //assert Assert.AreEqual(expected, actual); }
public void ConvertFromInvariantStringTestc() { tlog.Debug(tag, $"ConvertFromInvariantStringTestc START"); MyTypeConverter tc = new MyTypeConverter(); Assert.IsNotNull(tc, "null TypeConverter"); var ret1 = tc.ConvertFromInvariantString(null); Assert.IsNull(ret1, "Should be null"); ret1 = tc.ConvertToString(null); Assert.IsNull(ret1, "Should be null"); tlog.Debug(tag, $"ConvertFromInvariantStringTestc END"); }
public void ConvertFromTest1() { tlog.Debug(tag, $"ConvertFromTest1 START"); MyTypeConverter tc = new MyTypeConverter(); Assert.IsNotNull(tc, "null TypeConverter"); var ret = tc.ConvertFrom(null); Assert.IsNull(ret, "Should be null"); ret = tc.ConvertFrom(null, null); Assert.IsNull(ret, "Should be null"); tlog.Debug(tag, $"ConvertFromTest1 END"); }
public void GraphicsTypeManagerRegisterCustomConverterForDynamicResourceBinding() { tlog.Debug(tag, $"GraphicsTypeManagerRegisterCustomConverterForDynamicResourceBinding START"); string str = "GraphicsTypeManager"; Tizen.NUI.Binding.TypeConverter converter = new MyTypeConverter(); try { GraphicsTypeManager.Instance.RegisterCustomConverterForDynamicResourceBinding(str.GetType(), converter); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception: Failed!"); } tlog.Debug(tag, $"GraphicsTypeManagerRegisterCustomConverterForDynamicResourceBinding END (OK)"); }