public void DataPropertiesView_FxViewClosing_Event_UnSubscribed_From_When_View_Object_Is_Set_To_Null_From_Non_Null()
        {
            //Arrange
            var mockView = new Mock<IDataPropertiesView>();
            var mock2ndView = mockView.As<ISecondaryFxView>();
            var mockFx = new Mock<IDataPropertiesElementFx>();
            var mockCmpdFx = mockFx.As<ICompoundFx>();
            var args = new ViewActionEventArgs();

            mockFx.Setup(m => m.Properties).Returns("Blah");

            //Act
            _presenter = new DataPropertiesFxPresenter(null, null);
            _presenter.DataPropertiesFx = mockFx.Object;
            _presenter.DataPropertiesView = mockView.Object;
            _presenter.DataPropertiesView = null;

            //Assert
            mock2ndView.Raise(m => m.FxViewClosing += null, args);
            mockCmpdFx.Verify(m => m.Cancel(), Times.Never);
        }
        public void _View_FxViewClosing_EventHandler_Calls_Fx_Cancel()
        {
            var mockView = new Mock<IDataPropertiesView>();
            var mock2ndView = mockView.As<ISecondaryFxView>();
            var mockFx = new Mock<IDataPropertiesElementFx>();
            var mockCmpdFx = mockFx.As<ICompoundFx>();
            var ea = new ViewActionEventArgs();

            _presenter = new DataPropertiesFxPresenter(mockFx.Object, mockView.Object);

            //Act
            _presenter._View_FxViewClosing(mockView.Object, ea);

            //Assert
            mockCmpdFx.Verify(m => m.Cancel(), Times.Once);
        }
        public void DataPropertiesView_FxViewClosing_Event_Subscribed_To_When_View_Object_Is_Set()
        {
            var mockView = new Mock<IDataPropertiesView>();
            var mock2ndView = mockView.As<ISecondaryFxView>();
            var mockFx = new Mock<IDataPropertiesElementFx>();
            var mockCmpdFx = mockFx.As<ICompoundFx>();
            var args = new ViewActionEventArgs();

            mockCmpdFx.Setup(m => m.Cancel()).Verifiable();

            //Act
            _presenter = new DataPropertiesFxPresenter(null, null);
            _presenter.DataPropertiesFx = mockFx.Object;
            _presenter.DataPropertiesView = mockView.Object;

            //Assert
            mock2ndView.Raise(m => m.FxViewClosing += null, args);
            mockCmpdFx.Verify();
        }
Beispiel #4
0
 protected virtual void OnFxViewClosing(ViewActionEventArgs ea)
 {
     if (FxViewClosing != null)
         FxViewClosing(this, ea);
 }
 internal void _View_FxViewClosing(ISecondaryFxView sender, ViewActionEventArgs ea)
 {
     if (sender != null)
         Fx.Cancel();
 }
Beispiel #6
0
 public virtual void OnViewClosing(ViewActionEventArgs ea)
 {
     if (ViewClosing != null)
         ViewClosing(this, ea);
 }
 internal void secondView_ViewClosing(ISecondaryView sender, ViewActionEventArgs ea)
 {
     // do nothing
 }