예제 #1
0
        public async Task OneWay_Binding_Should_Be_Set_Up()
        {
            var source  = new { A = 1, B = 2, C = 3 };
            var binding = new MultiBinding
            {
                Converter = new ConcatConverter(),
                Bindings  = new[]
                {
                    new Binding {
                        Path = "A"
                    },
                    new Binding {
                        Path = "B"
                    },
                    new Binding {
                        Path = "C"
                    },
                }
            };

            var target = new Mock <IAvaloniaObject>().As <IControl>();

            target.Setup(x => x.GetValue(Control.DataContextProperty)).Returns(source);

            var observable = binding.Initiate(target.Object, null).Observable;
            var result     = await observable.Take(1);

            Assert.Equal("1,2,3", result);
        }