示例#1
0
        public void Ctor_Default_Creates_Instance()
        {
            //Arrange
            var _pipe = new NeutralPipe();

            Assert.NotNull(_pipe);
        }
示例#2
0
        public void Blob_Throws_Ex_If_There_Is_No_Upstream_Port()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            IBlob dataObj = null;

            var ex = Assert.Throws<InvalidOperationException>(() => dataObj = _pipe.Blob);
        }
示例#3
0
        public void ContentStatus_Throws_Ex_When_Source_Port_Is_Null()
        {
            //Arrange
            PayLoadStatus status;
            var _pipe = new NeutralPipe();

            _pipe.SourceNeutralPort = null;

            var ex = Assert.Throws<InvalidOperationException>(() => status = _pipe.ContentStatus);
        }
示例#4
0
        public void ContentStatus_Returns_Status_Of_Source_Port()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            var mockSourcePort = new Mock<IOutputNeutralPort>();

            mockSourcePort.Setup(m => m.OutputStatus).Returns(PayLoadStatus.Available);

            _pipe.SourceNeutralPort = mockSourcePort.Object;

            PayLoadStatus status = _pipe.ContentStatus;

            Assert.Equal(PayLoadStatus.Available, status);
        }
示例#5
0
        public INeutralPipe CreateNeutralPipe(Guid id)
        {
            NeutralPipe pipe = new NeutralPipe(id);
            using (SettingsMgrFactory fac = new SettingsMgrFactory())
            {
                pipe.SettingsMgr = fac.CreateSettingsMgr(pipe);
            }

            using (Providers.OptionsMgrFactory fac = new OptionsMgrFactory())
            {
                pipe.OptionsMgr = fac.CreateOptionsMgr(pipe);
            }

            return pipe;
        }
示例#6
0
        public void DestinationElement_Returns_Downstream_Element()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            var mockPort = new Mock<IInputNeutralPort>();
            var mockEl = new Mock<IElement>();

            mockPort.Setup(m => m.ParentElement).Returns(mockEl.Object);

            _pipe.DestinationNeutralPort = mockPort.Object;

            IElement element = (_pipe as NeutralPipe).DestinationElement;

            Assert.NotNull(element);
            Assert.Same(mockEl.Object, element);
        }
示例#7
0
        public void DestinationNeutralPort_Sets_And_Gets_The_InputNeutralPort_The_Pipe_Is_Attatched_To()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            var mockPort = new Mock<IInputNeutralPort>();
            _pipe.DestinationNeutralPort = mockPort.Object;

            IInputNeutralPort actualPort = _pipe.DestinationNeutralPort;
            Assert.NotNull(_pipe);
            Assert.Same(mockPort.Object, actualPort);
        }
示例#8
0
        public void _settingsMgr_SettingsChanged_EventHandler()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            var mockSettingsMgr = new Mock<ISettingsMgr>();

            var ex = Assert.Throws<NotImplementedException>(() => _pipe._settingsMgr_SettingsChanged(mockSettingsMgr.Object, null));
        }
示例#9
0
        public void SourcePort_Returns_Source_NeutralPort()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            var mockPort = new Mock<IOutputNeutralPort>();
            _pipe.SourceNeutralPort = mockPort.Object;

            IOutputPort actualPort = _pipe.SourcePort;

            Assert.NotNull(actualPort);
            Assert.Same(mockPort.Object, actualPort);
        }
示例#10
0
        public void SourceNeutralPort_Sets_And_Gets_The_OutputNeutralPort_The_Pipe_Is_AttatchedTo()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            var mockPort = new Mock<IOutputNeutralPort>();
            _pipe.SourceNeutralPort = mockPort.Object;

            IOutputNeutralPort actualPort = _pipe.SourceNeutralPort;
            Assert.NotNull(_pipe);
            Assert.Same(mockPort.Object, actualPort);
        }
示例#11
0
        public void SourceElement_Returns_Upstream_Element()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            var mockPort = new Mock<IOutputNeutralPort>();
            var mockEl = new Mock<IElement>();

            mockPort.Setup(m => m.ParentElement).Returns(mockEl.Object);

            _pipe.SourceNeutralPort = mockPort.Object;

            IElement element = (_pipe as NeutralPipe).SourceElement;

            Assert.NotNull(element);
            Assert.Same(mockEl.Object, element);
        }
示例#12
0
        public void SetIsSelected_Updates_The_Is_Selected_Flag_If_The_Value_Changes()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            // origin will not effect of the flag is updated. ,just may not allow the event to be fired.
            SelectionSource source = SelectionSource.Mouse;
            SelectionOrigin origin = SelectionOrigin.None;

            Assert.False(_pipe.IsSelected);

            _pipe.SetIsSelected(true, source, origin);

            Assert.True(_pipe.IsSelected);
        }
示例#13
0
        public void SetIsSelected_Fires_SelectionChangedEvent_If_The_Selection_Origin_Is_Business()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            SelectionSource source = SelectionSource.Code;
            SelectionOrigin origin = SelectionOrigin.Business;

            HelperForPipes helper = new HelperForPipes();
            _pipe.SelectionChanged += new SelectionEventHandler<IPipe, SelectionEventArgs>(helper.SelectionChanged_DummyHandler);

            _pipe.SetIsSelected(true, source, origin);

            Assert.True(_pipe.IsSelected);
            Assert.Equal(1, helper.SelectionChanged_TimesCalled);
        }
示例#14
0
        public void SetContentAvailability_Fires_ContentChangedEvent()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            ISetContentAvailability setter = _pipe as ISetContentAvailability;

            HelperForPipes helper = new HelperForPipes();
            _pipe.StatusChanged += new StatusChangeEventHandler<IPipe, PipeStatusChangeEventArgs>(helper.ContentStatusChange_DummyHandler);

            setter.SetContentAvailability(true);

            Assert.Equal(1, helper.ContentStatusChange_TimesCalled);
        }
示例#15
0
        public void OutputBlob_Returns_The_Upstream_Pipes_Ref_To_The_Blob()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            var mockSrcPort = new Mock<IOutputNeutralPort>();
            var mockBlob = new Mock<IBlob>();

            mockSrcPort.Setup(m => m.OutputBlob).Returns(mockBlob.Object).Verifiable();

            _pipe.SourceNeutralPort = mockSrcPort.Object;
            IBlob dataObj = _pipe.Blob;

            Assert.NotNull(dataObj);
            mockSrcPort.Verify();
        }
示例#16
0
        public void DestinationPort_Returns_Destination_NeutralPort()
        {
            //Arrange
            var _pipe = new NeutralPipe();
            var mockPort = new Mock<IInputNeutralPort>();
            _pipe.DestinationNeutralPort = mockPort.Object;

            IInputPort actualPort = _pipe.DestinationPort;

            Assert.NotNull(actualPort);
            Assert.Same(mockPort.Object, actualPort);
        }