public void BindToOneWayTestForRPSlim() { var target = new ReactivePropertySlim <string>(); var obj = new Poco(); target.BindTo(obj, o => o.Name); obj.Name.IsNull(); target.Value = "Hello world"; obj.Name.Is("Hello world"); }
public void BindToOnwWayConvertTestForRPSlim() { var target = new ReactivePropertySlim <int>(); var obj = new Poco(); target.BindTo( obj, o => o.Name, convert: i => "value is " + i); obj.Name.Is("value is 0"); target.Value = 1; obj.Name.Is("value is 1"); }
public void BindToTwoWayTestForRPSlim() { var target = new ReactivePropertySlim <string>(); var obj = new Poco(); target.BindTo(obj, o => o.Name, mode: BindingMode.TwoWay, targetUpdateTrigger: obj.ObserveProperty(o => o.Name).ToUnit()); obj.Name.IsNull(); target.Value = "Hello world"; obj.Name.Is("Hello world"); obj.Name = "tanaka"; target.Value.Is("tanaka"); }
public void BindToOneWayToSourceTestForRPSlim() { var target = new ReactivePropertySlim <string>(); var obj = new Poco(); target.BindTo(obj, o => o.Name, mode: BindingMode.OneWayToSource, convertBack: s => { Debug.WriteLine(s); return(s + "!"); }, targetUpdateTrigger: obj.ObserveProperty(o => o.Name).ToUnit()); obj.Name.IsNull(); obj.Name = "Hello"; target.Value.Is("Hello!"); }
public void BindToTwoWayConvertTestForRPSlim() { var target = new ReactivePropertySlim <int>(); var obj = new Poco(); target.BindTo(obj, o => o.Name, mode: BindingMode.TwoWay, convert: i => "value is " + i, convertBack: s => { Debug.WriteLine(s); return(int.Parse(s, NumberStyles.Integer)); }, targetUpdateTrigger: obj.ObserveProperty(o => o.Name).ToUnit()); obj.Name.Is("value is 0"); target.Value = 1; obj.Name.Is("value is 1"); obj.Name = "3"; target.Value.Is(3); }