public void CreationTest() { using (var vm = new MainWindowViewModel()) { Assert.IsNotNull(vm); var src = vm.GridDataCollectionView; Assert.IsNotNull(src); Assert.IsTrue(0 < src.Count); } }
public void UpdateCollectionTest() { using (var vm = new MainWindowViewModel()) { vm.PropertyChanged += FViewModel_PropertyChanged; var c = new ObservableCollection<CorrOrder>(); c.Add(new CorrOrder(1, ItemType.Fruits, "バナナ", "えええええおおおおお", 1234)); var s = (CollectionView)CollectionViewSource.GetDefaultView(c); // privateなメンバへアクセスするためアクセスオブジェクトを作成 var obj = new PrivateObject(vm); obj.SetProperty("GridDataCollectionView", s); vm.PropertyChanged -= FViewModel_PropertyChanged; Assert.IsTrue(this.FEventHappened); } }