public PageWithPrimitives SetPrimitiveProperty(string path, string value) { var page = new PageWithPrimitives { Content = new Label() }; InspectorReaction.Register <SetPropertyRequest, SetPropertyReaction>(page); var ctx = new UIMessageContext(); ctx.SetRequest <SetPropertyRequest>(req => { req.WidgetId = page.Id.ToString(); req.Path = new[] { path }; req.Value = value; }); Reaction.Execute(ctx); return(page); }
public void Should_get_nchar() { Dr.Add(typeof(ValueType), new StaticGenerator()); Dr.Add(typeof(Enum), new EnumGenerator()); Tr.SetTypes(typeof(Guid), typeof(char?)); var page = new PageWithPrimitives(); var ctx = new UIMessageContext(); ctx.SetRequest <GetWidgetPropertiesRequest>(req => { req.WidgetId = page.Id.ToString(); }); InspectorReaction.Register <GetWidgetPropertiesRequest, GetWidgetPropertiesReaction>(page); Reaction.Execute(ctx); var res = ctx.Get <GetWidgetPropertiesResponse>(); var type = res.Properties[0].UIType; Assert.IsTrue(type.IsNullable); Assert.AreEqual("Char?", type.ShortName); }
public void Should_get_nint() { Dr.Add(typeof(ValueType), new StaticGenerator()); Dr.Add(typeof(Enum), new EnumGenerator()); Tr.SetTypes(typeof(Guid), typeof(int?)); var page = new PageWithPrimitives(); var ctx = new XenMessageContext(); ctx.SetRequest <GetWidgetPropertiesRequest>(req => { req.WidgetId = page.Id.ToString(); }); XamarinFormsReaction.Register <GetWidgetPropertiesRequest, GetWidgetPropertiesReaction <VisualElement> >(page); Reaction.Execute(ctx); var res = ctx.Get <GetWidgetPropertiesResponse>(); var type = res.Properties[0].XenType; Assert.IsTrue(type.IsNullable); Assert.AreEqual("Int32?", type.ShortName); }