Beispiel #1
0
        public void ShouldBeSetTooIfStateIsNotOpened(Services.PortState portState)
        {
            var communicationService = new TestHartCommunicationService {
                PortState = portState
            };
            var viewModel = new StatusBarViewModel(communicationService);

            viewModel.PortName.Should().Be("COM1");
        }
Beispiel #2
0
        public void ShouldReturnDefaultValueOfService(Services.PortState expectedPortState)
        {
            var communicationMock = new Mock <IHartCommunicationService>();

            communicationMock.SetupGet(item => item.PortState).Returns(expectedPortState);

            var viewModel = new StatusBarViewModel(communicationMock.Object);

            viewModel.PortState.Should().Be(expectedPortState);
        }
Beispiel #3
0
        public void CanExecuteShouldBeFalseIfPortStateIsNotClosed(Services.PortState portState)
        {
            var uiVisualizerService = new Cinch.TestUIVisualizerService();
            var viewModel           = new RibbonViewModel(GetTestApplicationServices(), new CommonServices {
                UiVisualizerService = uiVisualizerService
            })
            {
                PortState = portState
            };

            viewModel.ConfigurateConnectionCommand.CanExecute(null).Should().BeFalse();
        }
Beispiel #4
0
        public void ShouldCanExecuteIfStateIsNotChanging(Services.PortState portState)
        {
            var messageBoxService        = new TestMessageBoxService();
            var hartCommunicationService = new TestHartCommunicationService {
                PortState = portState
            };
            var viewModel = new RibbonViewModel(new ApplicationServices {
                HartCommunicationService = hartCommunicationService
            }, new CommonServices {
                MessageBoxService = messageBoxService
            });

            viewModel.ConnectionCommand.CanExecute(null).Should().BeTrue();
        }