public void IsRegisteredShouldReturnFalseIfBindingIsNotRegistered() { var bindingMock = new DataBindingMock(); var manager = GetBindingManager(); manager.IsRegistered(bindingMock).ShouldBeFalse(); }
public void ManagerShouldClearAllBindingsForTargetAndPath() { const string path1 = "test"; const string path2 = "test2"; var target = new object(); var bindingFirst = new DataBindingMock(); var bindingSecond = new DataBindingMock(); var manager = GetBindingManager(); manager.Register(target, path1, bindingFirst); manager.Register(target, path2, bindingSecond); manager.IsRegistered(bindingFirst).ShouldBeTrue(); manager.IsRegistered(bindingSecond).ShouldBeTrue(); manager.ClearBindings(target, path1); manager.IsRegistered(bindingFirst).ShouldBeFalse(); manager.IsRegistered(bindingSecond).ShouldBeTrue(); manager.GetBindings(target).Single().ShouldEqual(bindingSecond); manager.ClearBindings(target, path2); manager.IsRegistered(bindingFirst).ShouldBeFalse(); manager.IsRegistered(bindingSecond).ShouldBeFalse(); manager.GetBindings(target).ShouldBeEmpty(); }
public void IsRegisteredShouldReturnTrueIfBindingIsRegistered() { const string path = "test"; var target = new object(); var bindingMock = new DataBindingMock(); var manager = GetBindingManager(); manager.Register(target, path, bindingMock); manager.IsRegistered(bindingMock).ShouldBeTrue(); }
public void ManagerShouldReturnAllBindingsForTargetAndPath() { const string path = "test"; var target = new object(); var bindingMock1 = new DataBindingMock(); var manager = GetBindingManager(); manager.Register(target, path, bindingMock1); manager.GetBindings(target, path).Single().ShouldEqual(bindingMock1); }
public void ManagerShouldRegisterBinding() { const string path = "test"; var target = new object(); var bindingMock = new DataBindingMock(); var manager = GetBindingManager(); manager.Register(target, path, bindingMock); manager.IsRegistered(bindingMock).ShouldBeTrue(); manager.GetBindings(target, path).Single().ShouldEqual(bindingMock); manager.GetBindings(target).Single().ShouldEqual(bindingMock); }
protected override void OnInit() { base.OnInit(); Behavior = CreateBehavior(); BindingMock = new DataBindingMock(); TargetAccessorMock = new BindingSourceAccessorMock(); SourceAccessorMock = new BindingSourceAccessorMock(); TargetSourceMock = new BindingSourceMock(); SourceSourceMock = new BindingSourceMock(); SourceAccessorMock.Source = SourceSourceMock; TargetAccessorMock.Source = TargetSourceMock; BindingMock.TargetAccessor = TargetAccessorMock; BindingMock.SourceAccessor = SourceAccessorMock; }
public void ManagerShouldReturnAllBindingsForTarget() { const string path = "test"; var target = new object(); var bindingMock1 = new DataBindingMock(); var bindingMock2 = new DataBindingMock(); var manager = GetBindingManager(); manager.Register(target, path, bindingMock1); manager.GetBindings(target).Single().ShouldEqual(bindingMock1); manager.Register(target, path + 1, bindingMock2); var bindings = manager.GetBindings(target).ToList(); bindings.Contains(bindingMock1).ShouldBeTrue(); bindings.Contains(bindingMock2).ShouldBeTrue(); bindings.Count.ShouldEqual(2); }
public void ManagerShouldClearBindingIfBindingIsRegistered() { const string path = "test"; var target = new object(); var bindingMock = new DataBindingMock { TargetAccessor = new BindingSourceAccessorMock { Source = new ObserverMock { Path = new BindingPath(path), GetActualSource = b => target } } }; var manager = GetBindingManager(); manager.Register(target, path, bindingMock); manager.IsRegistered(bindingMock).ShouldBeTrue(); manager.Unregister(bindingMock); manager.IsRegistered(bindingMock).ShouldBeFalse(); bindingMock.IsDisposed.ShouldBeTrue(); }