public void GivenRegisteredEventHandler_WhenExecuteCancelCommand_ThenEventIsProperlyRaised() { DialogViewModelBaseFixture dialogVmSubject = new DialogViewModelBaseFixture(); dialogVmSubject.CloseRequested += ChangeTestOutput; dialogVmSubject.CancelCommand.Execute(null); dialogVmSubject.CloseRequested -= ChangeTestOutput; Assert.Equal("N", TEST_OUTPUT); }
public async void GivenDragableEntity_WhenINvokingDragCommand_ThenItRaisesEvent() { DialogViewModelBaseFixture dialogVmSubject = new DialogViewModelBaseFixture(); Dragable dragable = new Dragable(); string response = null; dragable.DragActionEvent += e => response = e.Message; await Task.Run(() => dragable.DragMove()); Assert.Equal(dragable.GetHashCode().ToString(), response); dragable.DragActionEvent -= e => response = e.Message; }