public void Should_set_subobj_property_subobj_is_struct_and_readwrite() { var fake = new FakeStruct { Name = "Old Value" }; var view = new ViewHasSubProps { FakeVal = fake }; var page = new ContentPage { Content = view }; var ctx = new UIMessageContext(); ctx.SetRequest <SetPropertyRequest>(r => { r.WidgetId = view.Id.ToString(); r.Path = new[] { "FakeVal", "Name" }; r.Value = "A New Value"; }); Assert.AreEqual("Old Value", fake.Name); InspectorReaction.Register <SetPropertyRequest, SetPropertyReaction>(page); Reaction.Execute(ctx); Assert.AreEqual("A New Value", view.FakeVal.Name); }
public void Should_set_nested_struct_values() { var inner = new InnerStruct { Name = "Inner Struct" }; var fake = new FakeStruct { Inner = inner, Name = "Old Value" }; var view = new ViewHasSubProps { FakeVal = fake }; var page = new ContentPage { Content = view }; var ctx = new UIMessageContext(); ctx.SetRequest <SetPropertyRequest>(r => { r.WidgetId = view.Id.ToString(); r.Path = new[] { "FakeVal", "Inner", "Name" }; r.Value = "Newly Set"; }); Assert.AreEqual("Inner Struct", view.FakeVal.Inner.Name); InspectorReaction.Register <SetPropertyRequest, SetPropertyReaction>(page); Reaction.Execute(ctx); Assert.AreEqual("Newly Set", view.FakeVal.Inner.Name); }