Пример #1
0
        public void Disconnect_Removes_The_Connection_And_Returns_True()
        {
            //Arrange
            var unPlumber = new DataUnPlumber();
            var mockDestPort = new Mock<IInputDataPort>();
            var mockSrcPort = new Mock<IOutputDataPort>();
            var mockPipe = new Mock<IDataPipe>();

            mockPipe.Setup(m => m.SourceDataPort).Returns(mockSrcPort.Object);          // for setting dataPipe property
            mockPipe.Setup(m => m.DestinationDataPort).Returns(mockDestPort.Object);    // for setting dataPipe property

            unPlumber.DataPipe = mockPipe.Object;

            //Act
            bool result = unPlumber.Disconnect();

            //Assert
            Assert.True(result);
        }
Пример #2
0
        public void DisConnect_Fires_ConnectionCreatingEvent_Before_Creating_The_Connection()
        {
            //Arrange
            var unPlumber = new DataUnPlumber();
            var helper = new HelperForPlumbers();
            unPlumber.ConnectionDeleting += new ConnectionDeletionEventHandler(helper.ConnectionDeleting_DummyHandler);

            var mockDestPort = new Mock<IInputDataPort>();
            var mockSrcPort = new Mock<IOutputDataPort>();
            var mockPipe = new Mock<IDataPipe>();

            mockPipe.Setup(m => m.SourceDataPort).Returns(mockSrcPort.Object);          // for setting dataPipe property
            mockPipe.Setup(m => m.DestinationDataPort).Returns(mockDestPort.Object);    // for setting dataPipe property

            unPlumber.DataPipe = mockPipe.Object;

            //Act
            bool result = unPlumber.Disconnect();

            //Assert
            Assert.True(result);
        }