public void InitialThenChange()
 {
     var vm = new SelectObservableCollectionViewModel("test1");
     var vms = new ObservableCollection<SelectObservableCollectionViewModel>(new[] { vm });
     var result = vms.ToLiveLinq().Select(avm => avm.Name.AsObservable()).ToReadOnlyObservableList();
     result[0].Should().Be("test1");
     vm.Name.Value = "test2";
     result[0].Should().Be("test2");
 }
 public void AddThenChange()
 {
     var vm = new SelectObservableCollectionViewModel("test1");
     var vms = new ObservableCollection<SelectObservableCollectionViewModel>();
     var result = vms.ToLiveLinq().Select(avm => avm.Name.AsObservable()).ToReadOnlyObservableList();
     result.Should().BeEmpty();
     vms.Add(vm);
     result.Should().BeEquivalentTo("test1");
     vm.Name.Value = "test2";
     result.Should().BeEquivalentTo("test2");
 }
 public NestedViewModel(SelectObservableCollectionViewModel property)
 {
     Property = new ReactiveProperty<SelectObservableCollectionViewModel>(property);
 }
        public void SelectThenExceptThenUnion()
        {
            var coll1 = new ObservableCollection<SelectObservableCollectionViewModel>();
            coll1.Add(new SelectObservableCollectionViewModel("test"));
            var coll2 = new ObservableCollection<string>(new[] { "test" });
            var result1 = coll1.ToLiveLinq().Select(vm => vm.Name.AsObservable()).ToReadOnlyObservableList();
            var result2 = result1.ToLiveLinq().Except(coll2.ToLiveLinq()).ToReadOnlyObservableList();
            var tmp = new SelectObservableCollectionViewModel("ha");
            var result3 = result2.ToLiveLinq().Concat(tmp.Name.ToLiveLinq<string>()).ToReadOnlyObservableList();
            result1.Count.Should().Be(1);
            result1[0].Should().Be("test");
            result2.Count.Should().Be(0);
            result3.Count.Should().Be(1);
            result3[0].Should().Be("ha");

            coll1[0].Name.Value = "test2";
            result1.Count.Should().Be(1);
            result1[0].Should().Be("test2");
            result2.Count.Should().Be(1);
            result2[0].Should().Be("test2");
            result3.Should().BeEquivalentTo("test2", "ha");

            coll2[0] = "test2";
            result1.Count.Should().Be(1);
            result1[0].Should().Be("test2");
            result2.Count.Should().Be(0);
            result3.Should().BeEquivalentTo("ha");

            coll2[0] = "test3";
            result1.Count.Should().Be(1);
            result1[0].Should().Be("test2");
            result2.Should().BeEquivalentTo("test2");
            result3.Should().BeEquivalentTo("test2", "ha");

            coll2[0] = "ha";
            result3.Should().BeEquivalentTo("test2", "ha");
        }
 public void RemoveThenChange()
 {
     var vms = new ObservableCollection<SelectObservableCollectionViewModel>();
     var result = vms.ToLiveLinq().Select(vm => vm.Name.AsObservable()).ToReadOnlyObservableList();
     result.Count.Should().Be(0);
     var tmp = new SelectObservableCollectionViewModel("test1");
     vms.Add(tmp);
     result.Count.Should().Be(1);
     vms.RemoveAt(0);
     result.Count.Should().Be(0);
     tmp.Name.Value = "test2";
     result.Count.Should().Be(0);
 }
 public void SyncTo_RemoveThenChange()
 {
     var vms = new ObservableCollection<SelectObservableCollectionViewModel>();
     var result = new List<string>();
     vms.ToLiveLinq().Select(vm => vm.Name.AsObservable()).SyncTo(result, false);
     result.Count.Should().Be(0);
     var tmp = new SelectObservableCollectionViewModel("test1");
     vms.Add(tmp);
     result.Count.Should().Be(1);
     vms.RemoveAt(0);
     result.Count.Should().Be(0);
     tmp.Name.Value = "test2";
     result.Count.Should().Be(0);
 }
 public void SyncTo_AddThenChange()
 {
     var vm = new SelectObservableCollectionViewModel("test1");
     var vms = new ObservableCollection<SelectObservableCollectionViewModel>();
     var result = new List<string>();
     vms.ToLiveLinq().Select(avm => avm.Name.AsObservable()).SyncTo(result, false);
     result.Should().BeEmpty();
     vms.Add(vm);
     result.Should().BeEquivalentTo("test1");
     vm.Name.Value = "test2";
     result.Should().BeEquivalentTo("test2");
 }
 public void SyncTo_InitialThenChange()
 {
     var vm = new SelectObservableCollectionViewModel("test1");
     var vms = new ObservableCollection<SelectObservableCollectionViewModel>(new[] { vm });
     var result = new List<string>();
     vms.ToLiveLinq().Select(avm => avm.Name.AsObservable()).SyncTo(result, false);
     result[0].Should().Be("test1");
     vm.Name.Value = "test2";
     result[0].Should().Be("test2");
 }